Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Resetting the background color of a cell?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Resetting the background color of a cell?

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

--
Regards,
Tom Ogilvy


"Maury Markowitz" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Resetting the background color of a cell?

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

Thanks. Is the trick here the "index"?

Maury
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Resetting the background color of a cell?

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

--
Regards,
Tom Ogilvy

"Maury Markowitz" wrote in
message ...
Cells(lineno, 12).Interior.ColorIndex = xlNone


Thanks. Is the trick here the "index"?

Maury



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell background color and cell text color Jeff Klein Excel Worksheet Functions 1 November 1st 07 08:59 PM
Cell background color (interior color) setting not working Martin E. Excel Programming 1 May 21st 06 07:00 PM
Default Border, Font Color, and Cell Background Color Elijah Excel Discussion (Misc queries) 1 October 28th 05 04:10 PM
Set background color of a cell in VBA Cindy Excel Programming 9 January 16th 04 09:05 PM
Color of Cell Background Michael Kintner Excel Programming 2 January 6th 04 06:33 PM


All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"