CellBackColor Property

Returns or sets the background color of the selected cell or range.

Syntax

[form!]VSFlexGrid.CellBackColor[ = colorref& ]

Remarks

Setting this property to zero (black) causes the control to paint the cell using the standard colors (set by the BackColor and BackColorAlternate properties). Therefore, to set this property to black, use RGB(1,1,1) instead of RGB(0,0,0).

The following code only changes the back color of the current cell:

  FG.CellBackColor = vbRed

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property. To set the back color of an arbitrary range of cells (not necessarily the current selection), use the Cell property instead.

For example, the following code selects the first seven cells in column 3 and sets the BackColor for those cells:

  With fg

      .Select 1, 3, 7, 3

      .FillStyle = flexFillRepeat

      .CellBackColor = &HFF       'Red

      'return .FillStyle to its default (if needed)

      .FillStyle = flexFillSingle

      'Make cell 1, 1 the current cell so we can view the change

      .Select 1, 1

  End With

Data Type

Color

See Also

VSFlexGrid Control