Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cell reference in comparison formula

0 views
Skip to first unread message

E2out

unread,
May 4, 2007, 7:16:43 PM5/4/07
to
What I need to do (and I'm close to doing it) is I want to be able to enter
values in a cell but in the background (using a code module - VB) have those
values tested in a Value<cell value<value formula and then have the font
color change if the result is true.

so in other words

if (3.4<cell reference<13.9) then
sheet1.cell (2,2).font.color = rgb (255,0,0)
end if
end sub

Or something like this..

Right now the code only changes the font color regardless of the value
entered

thanks so much in advance

Jeff

Elkar

unread,
May 4, 2007, 7:36:00 PM5/4/07
to
I'd think Conditional Formatting might be more appropriate here than using
VB. Try this:

Select your cell to apply the format to (B2)
From the Format Menu, choose "Conditional Formatting..."
Change "Cell Value Is" to "Formula Is"
Enter the formula: =AND($A$1>3.4,$A$1<13.9)
Set your format (bold red)
Click OK

Change the cell reference in your formula as needed. That should do it.
But, if you still want to use the VB approach, try this:

IF cell reference > 3.4 AND cell reference < 13.9 THEN

HTH,
Elkar

0 new messages