Conditional Fomatting >3 in code

Giganews Newsgroups
Subject: Conditional Fomatting >3 in code
Posted by:  Nuttychick (Nuttychick.27heza_1147080001.0594@excelforum-nospam.com)
Date: Mon, 8 May 2006

Hi need a bit of help coding the equivalent to conditional formatting,
need to check a block of cells for certain values and format the colour
if the condition is true –  think it would be ok for the range to be by
columns  - the rows are variable but I can make the columns static.
Simple conditions all based on the text in the cell. i.e. =”VRF”  then
colour yellow. etc, problem is I need to specify this for about 12
different instances.
Have tried some of the code in the forums, but having problems with it
running.
Tried using this code from one of the threads but being a bit thick on
actually putting the code in the right place, this is all the macro
needs to do.
I created a new macro and ended up with the below, but not sure what to
do with the top few lines to set the macro up correctly.

Code:
--------------------
    Sub Macro6()
  '
  ' Macro6 Macro
  ' Macro recorded 08/05/06 by BZRMC3
  '

  '
  Private Sub Worksheet_Change(ByVal Target As Range)
  With Target
  If .Column = 4 Then
  Select Case .Value
  Case 0 To 2.99
  .EntireRow.Interior.ColorIndex = 4
  Case 3 To 5.99
  .EntireRow.Interior.ColorIndex = 6
  Case 6 To 9.99
  .EntireRow.Interior.ColorIndex = 39
  Case 10 To 14.99
  .EntireRow.Interior.ColorIndex = 41
  Case Is >= 15
  .EntireRow.Interior.ColorIndex = 3
  Case Else
  .EntireRow.Interior.ColorIndex = 0
  End Select
  End If
  End With
  End Sub
--------------------

Tried a few variations, i.e.

Code:
--------------------
    Private Sub Macro6 (ByVal Target As Range)
  '
  ' Macro6 Macro
  ' Macro recorded 08/05/06 by BZRMC3
  With Target
  If .Column = 4 Then
  Select Case .Value
  Case 0 To 2.99
  .EntireRow.Interior.ColorIndex = 4
  Case 3 To 5.99
  .EntireRow.Interior.ColorIndex = 6
  Case 6 To 9.99
  .EntireRow.Interior.ColorIndex = 39
  Case 10 To 14.99
  .EntireRow.Interior.ColorIndex = 41
  Case Is >= 15
  .EntireRow.Interior.ColorIndex = 3
  Case Else
  .EntireRow.Interior.ColorIndex = 0
  End Select
  End If
  End With
  End Sub
--------------------

Please can anyone advise where I am going wrong and perhaps explain a
resolution to me!

--
Nuttychick
------------------------------------------------------------------------
Nuttychick's Profile:http://www.excelforum.com/member.php?action=getinfo&userid=23017
View this thread:http://www.excelforum.com/showthread.php?threadid=539786

Replies