다음을 통해 공유


Slicers.Add Method (Excel)

Creates a new slicer and returns a Slicer object.

Version Information

추가된 버전: Excel 2010

Syntax

.Add(SlicerDestination, Level, Name, Caption, Top, Left, Width, Height)

A variable that represents a Slicers object.

Parameters

Name

Required/Optional

Data Type

Description

SlicerDestination

필수

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

선택

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

선택

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

선택

Variant

The caption of the slicer.

Top

선택

Variant

The initial vertical position of the slicer, in points, relative to the upper-left corner of cell A1 on a worksheet.

Left

선택

Variant

The initial horizontal position of the slicer, in points, relative to the upper-left corner of cell A1 on a worksheet.

Width

선택

Variant

The initial width, in points, of the slicer control.

Height

선택

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.

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

참고 항목

개념

Slicers Object Members

Slicers Object