color of text

T

Tammy

Is there a way (macro or vb code) to make a text appear a certain color. For
example, if the number in the cells a1:aa65000 >50 but <50000 then color them
red?
 
R

Ron Rosenfeld

Is there a way (macro or vb code) to make a text appear a certain color. For
example, if the number in the cells a1:aa65000 >50 but <50000 then color them
red?

Look at Conditional Formatting.

It can be invoked either directly from the Format menu in Excel, or used within
VBA.
--ron
 
V

Vergel Adriano

To change the font color in VBA, you use something like this

Range("A1").Font.Color = vbRed

But this is something you can do without using VBA. You can just use
Conditional Formatting.

1. Select the range you want to apply conditional formatting to.
2. Format->Conditional Formatting
3. Enter Condition 1 as cell value is between 51 and 49999
4. Click on Format button
5. Pick Red color for the font. click ok to close format cells dialog.
6. Click ok to close Contional Formatting dialog.
 
G

Gord Dibben

Tammy

What do you want if number is exactly 50 or 50000?

Format>Conditional Formatting>Cell Value is: between 50(or 50.1) and 50000(or
49999.9) depending upon the answer to first question.


Gord Dibben MS Excel MVP
 
Top