Cellbackgroundpaint usage

I have a listbox that is populated from a database…

Inside of cellbackgroundpaint is the following code:

if Val(me.cell(row,4)) > val(me.cell(row,5)) then
  
  g.ForeColor = &cD2FFF3
  g.DrawRect 0, 0, g.Width , g.Height
  g.ForeColor = &cD2EDF5
  g.FillRect 1, 1, g.Width - 2, g.Height - 2
  
end if

This code changes the color of the row where column 5 is less then column 4. This works, until the user scrolls down to the bottom of the listbox, then I get an error.

How do I tell the program to stop changing the cell background when the end of the listbox is reached?

If row < me.listcount then …

ok… that was easy… I was making that way too much harder than it had to be.

Thanks Jeff!