Results 1 to 5 of 5

Thread: Change MSHFlexgid cell color for negative values

  1. #1
    Guest

    Exclamation

    I have a MSHFlexgrid populated from a textarray loop and i have a total cell on the last row that calculates the above cells for each column. This is again calculated with a textarray statement in order that the focus isnt taken from the selected cell the user has chosen/moved to. I want to change the total cell color to red when a negative value is calculated. Specifying the row and col properties as a loop only takes the focus away. Helllllp

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    After populating the Grid, you can do something like this:
    Code:
        Dim intCol As Integer
        
        With MSHFlexGrid1
            For intCol = 0 To .Cols - 1
                If Val(.TextMatrix(.Rows - 1, intCol)) < 0 Then
                    .Row = .Rows - 1
                    .Col = intCol
                    .CellForeColor = vbRed
                End If
            Next
        End With

  3. #3
    Guest
    Yes this works but unfortunately the focus is taken away from the current cell after the function has executed. if a user enters a value into row 1 col 2 then moves with the right arrow to row 1 col 3 the function will run but the cell focus is now on row 4 col 32, the bottom right corner of the grid. How do return the focus to the users cell

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    You can memorize the position before you colorize cells and return to that cell after you colorize all cells.

  5. #5
    Guest

    Smile

    Many Thanks, superb service

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