Range Methods (Excel)

GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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.