Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Cell reference in comparison formula

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



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 964
Default Cell reference in comparison formula

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$13.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


"E2out" wrote:

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




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
format a cell with a formula so an empty reference cell shows blan M2 Excel Discussion (Misc queries) 3 November 7th 06 10:42 PM
Using a cell reference within a cell reference in a formula david Excel Worksheet Functions 2 July 1st 06 01:05 PM
How do I leave formula cell blank if 2nd reference cell is empty? Liana S Excel Discussion (Misc queries) 2 October 21st 05 04:38 PM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


All times are GMT +1. The time now is 05:07 PM.

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

About Us

"It's about Microsoft Excel"