A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

change background color based on range value



 
 
Thread Tools Display Modes
  #1  
Old February 6th, 2009, 09:01 PM posted to microsoft.public.excel.newusers
DanL
external usenet poster
 
Posts: 44
Default change background color based on range value

I would like to search a spread sheet for a specific range value Ie

c1 c2 c3 c4 c5 c6
20 30 40
20 30 40

When 20 30 and 40 are found in neighboring columns I would like to turn the
background of these 3 cells blue. How would I code this?

Thanks in advance - Dan
  #2  
Old February 6th, 2009, 09:34 PM posted to microsoft.public.excel.newusers
Paul
external usenet poster
 
Posts: 29
Default change background color based on range value

Use conditional formatting over the first range.

Set condition 1 to Formula-is option and in next box add
=COUNTIF($D$1:$F$5,A1)0
Format as appropriate.

$D$1:$F$5 is range being tested. Change as appropriate.
A1 is the first cell of the range being conditionally formatted.

There are lots of Youtube vids which may prove informative if you
want to learn more. Type conditional formatting in the site search
box to find vids on this particular aspect of Excel.

Regards
Paul



"DanL" wrote in message
...
I would like to search a spread sheet for a specific range value Ie

c1 c2 c3 c4 c5 c6
20 30 40
20 30 40

When 20 30 and 40 are found in neighboring columns I would like to turn
the
background of these 3 cells blue. How would I code this?

Thanks in advance - Dan



  #3  
Old February 6th, 2009, 09:35 PM posted to microsoft.public.excel.newusers
Don Guillett
external usenet poster
 
Posts: 6,167
Default change background color based on range value

Sub findgroups()
'With Worksheets(1).Range("a1:z500")
Set c = Cells.Find(20, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If c.Offset(, 1) = 30 And c.Offset(, 2) = 40 Then
c.Resize(, 3).Interior.ColorIndex = 33
End If
Set c = Cells.FindNext(c)
Loop While Not c Is Nothing And c.Address firstAddress
End If
'End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"DanL" wrote in message
...
I would like to search a spread sheet for a specific range value Ie

c1 c2 c3 c4 c5 c6
20 30 40
20 30 40

When 20 30 and 40 are found in neighboring columns I would like to turn
the
background of these 3 cells blue. How would I code this?

Thanks in advance - Dan


 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:45 PM.


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