Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Conditional Formatting adjacent cells

Hi Rachel,
See my previous response in this thread, but it sounds like you
are still looking for an answer; otherwise you would have said you
had your answer.

This example will change the color of the entire row based on
the value manually entered into Column F (column 6) having
"Yes" or "No" with an Event Macro instead of using Conditional Formatting. .

VBA is case sensitive whereas the worksheet formulas used in
Conditional Formatting were not, so the testing will be of the
value as converted to lowercase.

Read again about Event Macros in
http://www.mvps.org/dmcritchie/excel/event.htm#case

To install right click on the sheet tab then View code, insert code

Private Sub Worksheet_Change(ByVal Target As Range)
'David McRitchie, 2004-09-26, programming, Case -- Entire Row
' http://www.mvps.org/dmcritchie/excel/event.htm#case_row
If Target.Column < 6 Then Exit Sub 'Column F is column 6
If Target.Row = 1 Then Exit Sub
Application.EnableEvents = False 'should be part of Change macro
Select Case LCase(Target.Value)
Case "yes"
Target.EntireRow.Interior.ColorIndex = 34
Case "no"
Target.EntireRow.Interior.ColorIndex = 36
Case Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexAutomatic
End Select
Application.EnableEvents = True 'should be part of Change macro
End Sub
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Rachel Curran" wrote in message
Yes, I need this to be in code please




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 adjacent cells Sketch Excel Worksheet Functions 3 July 6th 09 07:44 PM
Conditional Formatting Relative to adjacent cells Max Excel Discussion (Misc queries) 2 June 2nd 09 04:50 AM
Conditional formatting on ADJACENT Cells jayceejay Excel Discussion (Misc queries) 4 January 6th 09 07:49 PM
Conditional Formatting for adjacent cells Drew Excel Discussion (Misc queries) 1 October 20th 06 08:28 PM
conditional formatting adjacent cells jbsand1001 Excel Worksheet Functions 2 January 20th 05 09:55 PM


All times are GMT +1. The time now is 03:46 AM.

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

About Us

"It's about Microsoft Excel"