Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old January 16th 04, 03:47 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2004
Posts: 19
Default Set background color of a cell in VBA

Anyone know how to change the background color of a cell
in Excel 2000 VBA code? Thank you

Cindy

  #2   Report Post  
Old January 16th 04, 04:05 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2004
Posts: 1
Default Set background color of a cell in VBA

I suggest the best method would be to record a macro of the chang
required

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Old January 16th 04, 04:11 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 27,285
Default Set background color of a cell in VBA

activecell.Interior.ColorIndex = 3

--
Regards,
Tom Ogilvy

"Cindy" wrote in message
...
Anyone know how to change the background color of a cell
in Excel 2000 VBA code? Thank you

Cindy



  #4   Report Post  
Old January 16th 04, 04:12 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 7,247
Default Set background color of a cell in VBA

Cindy,

Try something like the following.

Range("A1").Interior.ColorIndex = 6 'yellow


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Cindy" wrote in message
...
Anyone know how to change the background color of a cell
in Excel 2000 VBA code? Thank you

Cindy



  #5   Report Post  
Old January 16th 04, 04:14 PM posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Set background color of a cell in VBA


-----Original Message-----
Anyone know how to change the background color of a cell
in Excel 2000 VBA code? Thank you

Cindy
.

You need to use the Interior property of the Range object:
Range("A1").Interior.Color = ColorValue

ColorValue is a number specifying the color, or you can
use the RGB function RGB(RedValue,GreenValue,BlueValue)
where RedValue,GreenValue, and BlueValue are 0-255. For
example, yellow is pure red and pure green mixed together
or RGB(255,255,0).


  #6   Report Post  
Old January 16th 04, 04:36 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2004
Posts: 19
Default Set background color of a cell in VBA

Thanks to all that replied. It works.

Maybe you can help futher. What I need to do is check 8
specific cells on a sheet to be sure they contain a value
before the user can continue. My idea is to change the
color of those cells that are empty - which works. But
now I'm trying to figure out the best way to recheck the
cells and reset the color to white, where I might need to
do this several times, depending if the user actually
entered data in all 8 cells.

Right now I'm using 8 separate If statements to check the
cells for values.

Thanks

Cindy
-----Original Message-----
Cindy,

Try something like the following.

Range("A1").Interior.ColorIndex = 6 'yellow


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Cindy" wrote in message
...
Anyone know how to change the background color of a cell
in Excel 2000 VBA code? Thank you

Cindy



.

  #7   Report Post  
Old January 16th 04, 04:40 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 7,247
Default Set background color of a cell in VBA

Cindy,

You might want to use the Conditional Formatting tool on the
Format menu to do this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Cindy" wrote in message
...
Thanks to all that replied. It works.

Maybe you can help futher. What I need to do is check 8
specific cells on a sheet to be sure they contain a value
before the user can continue. My idea is to change the
color of those cells that are empty - which works. But
now I'm trying to figure out the best way to recheck the
cells and reset the color to white, where I might need to
do this several times, depending if the user actually
entered data in all 8 cells.

Right now I'm using 8 separate If statements to check the
cells for values.

Thanks

Cindy
-----Original Message-----
Cindy,

Try something like the following.

Range("A1").Interior.ColorIndex = 6 'yellow


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Cindy" wrote in message
...
Anyone know how to change the background color of a cell
in Excel 2000 VBA code? Thank you

Cindy



.



  #8   Report Post  
Old January 16th 04, 04:45 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Nov 2003
Posts: 26
Default Set background color of a cell in VBA

That was one of my first thoughts but there is no criteria
for a "null" cell.
-----Original Message-----
Cindy,

You might want to use the Conditional Formatting tool on

the
Format menu to do this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Cindy" wrote in message
...
Thanks to all that replied. It works.

Maybe you can help futher. What I need to do is check 8
specific cells on a sheet to be sure they contain a

value
before the user can continue. My idea is to change the
color of those cells that are empty - which works. But
now I'm trying to figure out the best way to recheck the
cells and reset the color to white, where I might need

to
do this several times, depending if the user actually
entered data in all 8 cells.

Right now I'm using 8 separate If statements to check

the
cells for values.

Thanks

Cindy
-----Original Message-----
Cindy,

Try something like the following.

Range("A1").Interior.ColorIndex = 6 'yellow


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Cindy" wrote in message
...
Anyone know how to change the background color of a

cell
in Excel 2000 VBA code? Thank you

Cindy


.



.

  #9   Report Post  
Old January 16th 04, 07:43 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 7,247
Default Set background color of a cell in VBA

Cindy,

You can use conditional formatting. In the CF dialog, change
"Cell Value Is" to "Formula Is" and enter the formula

=LEN(A1)=0

where A1 is the appropriate cell reference.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Cindy" wrote in message
...
That was one of my first thoughts but there is no criteria
for a "null" cell.
-----Original Message-----
Cindy,

You might want to use the Conditional Formatting tool on

the
Format menu to do this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Cindy" wrote in message
...
Thanks to all that replied. It works.

Maybe you can help futher. What I need to do is check 8
specific cells on a sheet to be sure they contain a

value
before the user can continue. My idea is to change the
color of those cells that are empty - which works. But
now I'm trying to figure out the best way to recheck the
cells and reset the color to white, where I might need

to
do this several times, depending if the user actually
entered data in all 8 cells.

Right now I'm using 8 separate If statements to check

the
cells for values.

Thanks

Cindy
-----Original Message-----
Cindy,

Try something like the following.

Range("A1").Interior.ColorIndex = 6 'yellow


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Cindy" wrote in message
...
Anyone know how to change the background color of a

cell
in Excel 2000 VBA code? Thank you

Cindy


.



.



  #10   Report Post  
Old January 16th 04, 10:05 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2003
Posts: 32
Default Set background color of a cell in VBA

The null condition is the starting condition. So the cell can be
yellow when there is nothing in it, and then the Conditional
Formatting would be white if the cell value is not blank (or vice
versa).


"Cindy" wrote in message ...
That was one of my first thoughts but there is no criteria
for a "null" cell.
-----Original Message-----
Cindy,

You might want to use the Conditional Formatting tool on

the
Format menu to do this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Cindy" wrote in message
...
Thanks to all that replied. It works.

Maybe you can help futher. What I need to do is check 8
specific cells on a sheet to be sure they contain a

value
before the user can continue. My idea is to change the
color of those cells that are empty - which works. But
now I'm trying to figure out the best way to recheck the
cells and reset the color to white, where I might need

to
do this several times, depending if the user actually
entered data in all 8 cells.

Right now I'm using 8 separate If statements to check

the
cells for values.

Thanks

Cindy
-----Original Message-----
Cindy,

Try something like the following.

Range("A1").Interior.ColorIndex = 6 'yellow


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Cindy" wrote in message
...
Anyone know how to change the background color of a

cell
in Excel 2000 VBA code? Thank you

Cindy


.



.



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 Joe Gieder Excel Worksheet Functions 4 July 15th 08 09:24 PM
cell background color and cell text color Jeff Klein Excel Worksheet Functions 1 November 1st 07 09:59 PM
How do I- IF the cell background is RED in color then contain 1 sunshine19992 Excel Worksheet Functions 3 May 23rd 07 09:26 PM
Default Border, Font Color, and Cell Background Color Elijah Excel Discussion (Misc queries) 1 October 28th 05 04:10 PM
Color of Cell Background Michael Kintner Excel Programming 2 January 6th 04 07:33 PM


All times are GMT +1. The time now is 03:11 PM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017