Sub that takes the value of a function

AT--o

New Member
Joined
Aug 24, 2010
Messages
19
Hi.
In excel 2007.

My function takes its arguments from cells on the same row that it is inserted. I just copy it down. The problem is I need to change the Interior of this cell (the one containing the function) according to values that while taken from operations between the arguments are not the value of the function. (otherwise I would use excel conditional formatting). I know the interior of a cell can't be changed by a function so...

Whats the code for the Sub? Im specially confuse about passing the arguments.
 

kpark91

Well-known Member
Joined
Jul 15, 2010
Messages
1,582
{Cell}.Interior.Color = RGB(0~255,0~255,0~255)

Example:
If you want to color your cell's interior red.
Range("A1").Interior.Color = RGB (255,0,0)
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
You can use conditional formatting to format one cell based on values in OTHER cells..

Selcect "Formula Is" instead of Value is
and enter a formula

So you could color cell B1 based on A1's Value.

Highlight B1, and click Conditional Formatting - New Rule.
Selct "Use a Formula to determine..." from the Rule Type
Enter
=A1="Hello"
Select your format and click OK

Now B1 will change format based on A1's value changing to "Hello"


Hope that helps.
 
Last edited:

Forum statistics

Threads
1,082,438
Messages
5,365,531
Members
400,837
Latest member
ELMST616

Some videos you may like

This Week's Hot Topics

Top