ColumnCount Property

See Also Applies To Example Model

Returns the number of columns in a collection. Read only Long.

Example

The following example sets all Cell objects on the diagonal of the cell grid to the color red using RowCount and ColumnCount properties.

For i = 1 To Cells.RowCount
     For j = 1 To Cells.ColumnCount
          If i=j Then Cells(i,j).Color = vbtRed
     Next j
Next i