The Column and Row properties

The Column property returns the column number of a single-cell range; the Row property returns the row number of a single-cell range. Both are readonly properties. For example, the following statement displays 6 because the cell is in the sixth column:

MsgBox Sheets("Sheet1").Range("F3").Column

The next expression displays 3 because cell F3 is in the third row:

MsgBox Sheets("Sheet1").Range("F3").Row

JcJABE/?

JcJABE/?

If the Range object consists of more than one cell, the Column property returns the column number of the first column in the range, and the Row property returns the row number of the first row in the range.

Don't confuse the Column and Row properties with the Columns and Rows properties (discussed earlier in this chapter). The Column and Row properties return a single value. Columns and Rows properties return a Range object.

0 0

Post a comment