Click or drag to resize

ExcelRange Methods

The ExcelRange type exposes the following members.

Methods
 NameDescription
Public methodAddAutoFilter Adds an AutoFilter to this range: drop-down arrows in the first row of the range, which is the header row. The AutoFilter replaces the previous AutoFilter of the worksheet, if any. Set the column filters with the methods of the returned object. A single cell selects the region of adjacent non-empty cells around it.
Public methodAddComment Adds the comment with the specified text to this range. The range is expected to contain a single cell otherwise the comment will be placed on the top left cell of the range.
Public methodAutofitColumns Changes the width of the range columns to achieve the best fit for the cells content.
Public methodAutofitRows Changes the height of the range rows to achieve the best fit for the cells content.
Public methodClear Clears the range content and the cells formatting
Public methodClearContents Clears the range content but leaves the cells formatting
Public methodCopy Copies this range to the specified destination range.
Public methodDelete Deletes the cell in the range and shifts cells up to replace the deleted cells.
Public methodDelete(ExcelDeleteShiftDirection) Deletes the cell in the range and shifts cells in the specified direction to replace the deleted cells.
Public methodFind(String) Finds the cells of this range that display the specified text, in any part of the cell and without regard to case. The text of a formula cell is its calculated result; call UpdateFormulaResult first to calculate the formulas added in code.
Public methodFind(String, ExcelFindOptions) Finds the cells of this range that display the specified text, with the specified options. The text of a formula cell is its calculated result; call UpdateFormulaResult first to calculate the formulas added in code.
Public methodFreezePanes Freezes panes to keep row and column labels visible when the worksheet is scrolled. To lock rows select the row below where you want the freeze to appear (e.g. The range "A5" will freeze the rows from 1 to 4). To lock columns select the column to the right of where you want the split to appear (e.g. The range "D1" will freeze the columns A, B and C). To lock both rows and columns select the cell below and to the right of where you want the split to appear (e.g. The range "D5" will freeze the rows from 1 to 4 and the columns A, B and C).
Public methodGroup(ExcelGroupBy) Groups the range by rows or columns function of the groupBy parameter.
Public methodGroup(ExcelGroupBy, Boolean) Groups the range by rows or columns function of the groupBy parameter.
Public methodMerge Merge the cells in this range in a merged area.
Public methodMove Moves the range to the specified destination range.
Public methodReplace(String, String) Replaces a text with another text in the cells of this range that contain text, in any part of the cell and without regard to case. Formulas, numbers, dates and booleans are not changed.
Public methodReplace(String, String, ExcelFindOptions) Replaces a text with another text in the cells of this range that contain text, with the specified options. With MatchEntireCellContent the whole cell text is replaced when it is equal to the old text; otherwise every occurrence of the old text in the cell is replaced. Formulas, numbers, dates and booleans are not changed.
Public methodSort(ExcelSortKey, Boolean) Sorts the rows of this range by one or more columns: the rows with equal values in the first key column are sorted by the second key column and so on; rows with equal keys keep their order. The values, formulas and cell formats move with the rows; the relative references of the moved formulas are adjusted to the new row, as in Excel. Numbers and dates come before texts, texts are compared without regard to case and the blank cells are placed last. Formula cells are sorted by their calculated results (call UpdateFormulaResult first for the formulas added in code). The range cannot contain merged cells.
Public methodSort(ExcelSortKey, Boolean, Boolean) Sorts the rows of this range by one or more columns, optionally matching the case of the texts. The values, formulas and cell formats move with the rows; the relative references of the moved formulas are adjusted to the new row, as in Excel. Numbers and dates come before texts and the blank cells are placed last. Formula cells are sorted by their calculated results (call UpdateFormulaResult first for the formulas added in code). The range cannot contain merged cells.
Public methodSort(Int32, ExcelSortOrder, Boolean) Sorts the rows of this range by a column. The values, formulas and cell formats move with the rows; the relative references of the moved formulas are adjusted to the new row, as in Excel. Numbers and dates come before texts, texts are compared without regard to case and the blank cells are placed last. Formula cells are sorted by their calculated results (call UpdateFormulaResult first for the formulas added in code). The range cannot contain merged cells.
Public methodUnGroup Ungroups the range.
Public methodUnMerge Separates a merged range into individual cells.
Top
See Also