I am trying to set the background of Col 7 to red in every Row where value of Col 7 is 0 or less. I load the grid from a table and the number of rows is always different. How would I do this?
this would set all col 7 to red, without checking for value after the grid is loaded. How would I do this while loading the grid when the number of rows is unknown yet. While doing the loop loading rows check for value of col 7 and then set the value of col 7 for the current row to Red.
Dim lngCol As Long
Dim lngRow As Long
lngCol = 7
For lngRow = 0 To fg1.Rows - 1
fg1.Col = lngCol
fg1.Row = lngRow
Select Case Val(fg1.Text)
Case Is < 0
fg1.CellBackColor = vbRed
Case Else
fg1.CellBackColor = vbWhite
End Select
Next
This is sample code only - it has no error checking, but may get you started
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.