Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Conditional Formatting multiple cells if one cells says "X"...

Hi All
I know that I need to write code (VBA) to address this conditional
formatting, but I'm a novice and after reading all the postings on
conditional formatting I can't work it out - please help...

There are 5 conditions and the formatting applies to a growing number of
cells (current range is M14:GR603 - but the number of rows will increase).

The conditions a
If "Retail" is entered in column E of this row, then colour this cell pink
If "Brand" is entered in column E of this row, then colour this cell blue
If "Special" is entered in column E of this row, then colour this cell yellow
If "Generic" is entered in column E of this row, then colour this cell green
If "Other" is entered in column E of this row, then don't colour the cell.

I am using Excel 2000 (if that makes any difference).
Thank for your help
BeSmart
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Conditional Formatting multiple cells if one cells says "X"...

BeSmart,

You can use the worksheet's change event keyed to column E.

Copy the code below, right click on the sheet tab, select "View Code" and
paste the code in the window that appears.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
If Not Intersect(Target, Range("E:E")) Is Nothing Then
For Each myCell In Intersect(Target, Range("E:E"))
If myCell.Value = "Retail" Then
Range(Range("M" & myCell.Row), Range("AG" & myCell.Row)) _
.Interior.ColorIndex = 38
End If
If myCell.Value = "Brand" Then
Range(Range("M" & myCell.Row), Range("AG" & myCell.Row)) _
.Interior.ColorIndex = 37
End If
If myCell.Value = "Special" Then
Range(Range("M" & myCell.Row), Range("AG" & myCell.Row)) _
.Interior.ColorIndex = 36
End If
If myCell.Value = "Generic" Then
Range(Range("M" & myCell.Row), Range("AG" & myCell.Row)) _
.Interior.ColorIndex = 35
End If
If myCell.Value = "Other" Then
Range(Range("M" & myCell.Row), Range("AG" & myCell.Row)) _
.Interior.ColorIndex = xlNone
End If
Next myCell
End If
End Sub

"BeSmart" wrote in message
...
Hi All
I know that I need to write code (VBA) to address this conditional
formatting, but I'm a novice and after reading all the postings on
conditional formatting I can't work it out - please help...

There are 5 conditions and the formatting applies to a growing number of
cells (current range is M14:GR603 - but the number of rows will increase).

The conditions a
If "Retail" is entered in column E of this row, then colour this cell pink
If "Brand" is entered in column E of this row, then colour this cell blue
If "Special" is entered in column E of this row, then colour this cell

yellow
If "Generic" is entered in column E of this row, then colour this cell

green
If "Other" is entered in column E of this row, then don't colour the cell.

I am using Excel 2000 (if that makes any difference).
Thank for your help
BeSmart



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
Conditional Formatting - find cells containg "+" Colin Hayes Excel Discussion (Misc queries) 3 March 19th 10 03:26 PM
Combine text from multiple cells into one cell - =(A1&","&A2","&A3 mh Excel Worksheet Functions 5 July 27th 09 02:40 AM
Conditional formatting cells with formulas = "#VALUE!" Marcus Analyst Excel Discussion (Misc queries) 1 January 4th 08 06:09 PM
Using conditional formatting to "blank" cells terryc Excel Discussion (Misc queries) 1 June 26th 06 06:19 PM
Can you "duplicate" "copy" listboxes and code to multiple cells? HotRod Excel Programming 1 September 1st 04 05:03 PM


All times are GMT +1. The time now is 05:14 AM.

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"