Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)
The following properties and methods for returning a Range object are described in this section:
Use Range(arg), where arg names the range, to return a Range object that represents a single cell or a range of cells.
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).
Use Cells(row, column), where row is the row index and column is the column index, to return a single cell.
There may be times when the Cells property is more convenient because you can use a variable for the row or column. Note 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).
Use Cells(row, column), where row and column are relative to the upper-left corner of the range, to return part of a range.
Range and Cells
Use Range(cell1, cell2), where cell1 and cell2 are Range objects that specify the start and end cells, to return a Range object.
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. You cannot select a cell that isn’t on the active sheet, so you must first activate the worksheet.
Use Union(range1, range2, ...) to return multiple-area ranges — that is, ranges composed of two or more contiguous blocks of cells.
If you work with selections that contain more than one area, the Areas property is very 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 check for a selection that contains more than one area.
Si vous souhaitez y participer,