Resetting the background color of a cell?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm sure this is an easy one, but...

I have a VBA macro that rolls over a bunch of rows and colors cells that I
think might be bad, either yellow or red depending on the error.

The user then fixes the problems and runs again. Thus I want to clear out
any color that might be there, because it's likely been fixed.

So I did...

Cells(lineno, 12).Interior.Color = vbWhite

But this also makes the cell borders disappear! They are set to "automatic"
in the format dialog.

What am I doing wrong?

Maury
 
Cells(lineno, 12).Interior.ColorIndex = xlNone

Thanks. Is the trick here the "index"?

Maury
 
Excel only supports 56 colors in a worksheet. So using ColorIndex can be
very straighforward. Once using colorindex, then the trick is using xlNone.
 
Back
Top