If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > color fill

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-09, 11:28
robertiu robertiu is offline
Registered User
 
Join Date: May 2009
Posts: 3
color fill

Is it posible to have an VBA code that will, like conditional formatting does, fill the cell with color when you type in a number; this time we have a sequence or condition that the conditional formatting can't do. here's the trick: let's say we have cell A1 and cell B1, and default cell color is white,
if we put any number in cell A1 it will change to color red; then whenever we put any number on cell B1, the cell B1 will turn to black; here's the turning point when B1 changes color fill, the cell A1 will also change into black from its color of red.

Any assistance is appreciated.
Attached Files
File Type: zip Sales Report.zip (11.1 KB, 5 views)

Last edited by robertiu; 05-15-09 at 11:32.
Reply With Quote
  #2 (permalink)  
Old 05-17-09, 10:00
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Hi Robert,

It is possible to do this in VBA. However it is unnecessary because it can be done using conditional formatting. I've attached an example in Excel 2007 (that's the version I have at home).

The conditional formatting formula to turn A1 and B1 black is:
Code:
=AND(ISNUMBER($A$1),ISNUMBER($B$1))
The conditional formatting formula to turn A1 red is:
Code:
=ISNUMBER($A$1)
Hope that helps...
Attached Files
File Type: zip Conditional Formatting.zip (5.1 KB, 12 views)
Reply With Quote
  #3 (permalink)  
Old 05-18-09, 04:27
robertiu robertiu is offline
Registered User
 
Join Date: May 2009
Posts: 3
RE: color fill

Thank you for your reply, however this is what i want to happen, if I put any number on A1, A1 will turn into color red then if I put any number on B1, B1 will turn into black, so we have A1 as red and B1 as black, but I want is that if B1 will change into black the A1 will also turn into black.
(Red for us is unpaid then when it turns black then it is paid.)

I got here some pictures on how I want it to work. It is in order from 1 to 5
Attached Files
File Type: zip Excel Pictures.zip (364.2 KB, 8 views)
Reply With Quote
  #4 (permalink)  
Old 05-18-09, 11:05
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Yes, you will need VBA for that last condition because it is checking the color of another cell, and that cannot be done with formulas (unless you write a function in VBA to achieve that). Check out Pearson's excellent help.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #5 (permalink)  
Old 05-18-09, 13:43
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Quote:
Originally Posted by robertiu
Thank you for your reply, however this is what i want to happen, if I put any number on A1, A1 will turn into color red then if I put any number on B1, B1 will turn into black, so we have A1 as red and B1 as black, but I want is that if B1 will change into black the A1 will also turn into black.
(Red for us is unpaid then when it turns black then it is paid.)

I got here some pictures on how I want it to work. It is in order from 1 to 5
Hi Robert,

That is exactly what I attached on my post.

The combinations are:
A1 is a number / B1 is not a number ---> A1 is red, B1 is no fill.
A1 is a number / B1 is a number ---> A1 is black, B1 is black.
A1 is not a number / B1 is a number ---> A1 is no fill, B1 is black
A1 is not a number / B1 is not a number ---> A1 is no fill, B1 is no fill.


You do not need VBA to do this because you can check the underlying values in each cell as outlined by my formulas in post #2.

I have now attached an example using Excel 2002. You can toggle the font colours in the conditional formatting also.
Attached Files
File Type: zip conditional formatting example.zip (1.6 KB, 6 views)
Reply With Quote
  #6 (permalink)  
Old 05-19-09, 00:19
robertiu robertiu is offline
Registered User
 
Join Date: May 2009
Posts: 3
color fill

In the Philippines we say MABUHAY KA and thank you.
Reply With Quote
  #7 (permalink)  
Old 05-19-09, 14:47
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
In the United Kingdom we say "you are welcome!".
Reply With Quote
  #8 (permalink)  
Old 06-19-09, 11:30
oxysleddy oxysleddy is offline
Registered User
 
Join Date: Jun 2009
Location: United States
Posts: 1
looking for a shoe website

I was checking few blogs and they talk about some really great unique models of Jordan shoes and Air Force Ones, I've been looking online for a websites where I can by those Nike shoes from but I only find websites that sell fake shoes, I was hopping someone can help me find a websites that sell some real limited and unique styles of those shoes, like Nike dunks, Nike Air Max...but something real. Thank you everyone.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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