Results 1 to 4 of 4

Thread: Selecting entire colums in MSFlexGrid

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Post

    I am using the following code to color all the cells in column 1 and 2. However, only the first two rows of columns 1 and 2 are changing color.

    With MSFlexGrid1
    .col = 1
    .cellbackcolor = vbRed
    .col = 2
    .cellbackcolor = vbblue
    End With

    Can someone show me a method to color the entire 2 columns.

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    you need to cycle through the rows.

    for intI = 0 to MSFlexGrid1.rows -1
    .row = inti

    'do the col colors here
    next inti

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    An easier method would be to set the RowSel property and also set the FillStyle Property to flexFillRepeat, ie.
    Code:
    Private Sub Command1_Click()
        With MSFlexGrid1
            .Row = 0
            .Col = 1
            .FillStyle = flexFillRepeat
            .RowSel = .Rows - 1
            .ColSel = 1
            .CellBackColor = vbRed
            .Col = 2
            .ColSel = 2
            .RowSel = .Rows - 1
            .CellBackColor = vbBlue
            .Col = 0
            .FillStyle = flexFillSingle
        End With
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Aaron, I didn't think of that. I forgot about the FillRepeat option. That would work way better.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width