Results 1 to 2 of 2

Conditional Format Multiple Criteria VBA

Threaded View

SamsamF Conditional Format Multiple... 07-21-2011, 06:02 AM
Whizbang Re: Conditional Format... 07-21-2011, 08:45 AM
  1. #1
    Registered User
    Join Date
    08-12-2009
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Conditional Format Multiple Criteria VBA

    I have 2 columns of data - Name (A) and Index (B) - and the following VBA, so when Index (B) is a certain value (or within a specific range) that Index (B) cell changes color:

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        Set I = Intersect(Target, Range("B2:B10"))
    
        If Not I Is Nothing Then
            Select Case Target
                Case 0 To 50: Newcolor = 37     'light blue
                Case 51 To 100: Newcolor = 46   'orange
                Case 101 To 150: Newcolor = 12  'dark yellow
                Case 151 To 200: Newcolor = 10  'green
                Case 200 To 250: Newcolor = 3   'red
                Case "A": Newcolor = 13  'violet
                Case "B": Newcolor = 54  'plum
                Case "C": Newcolor = 38  'rose
            End Select
            Target.Interior.ColorIndex = Newcolor
        End If
    
    End Sub

    This works well for multiple Conditional Format, but only changes the cell color for Index (B).

    How can I modify this so the value in Index (B) will also change the cell color for Name (A) adjacent?

    e.g. "215" in B5 changes cell B5 and A5 to red. (using Excel 2003)
    Last edited by SamsamF; 07-21-2011 at 06:05 AM. Reason: Add Excel Version

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1