+ Reply to Thread
Results 1 to 2 of 2

Conditional Formatting using VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    05-18-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2003
    Posts
    29

    Conditional Formatting using VBA

    I'm trying to highlight 2 cells when a particular name is in a column using conditional formatting. I have to use VBA code as I already have 3 other conditional statements. The code works other than when the name is removed or change, the color formatting remains. I want it to only be there when this text(name) is in the column. Here is my coding:

    Private Sub Worksheet_Change(ByVal Target As Range)

    Set MyPlage = Range("A1:T250")
    For Each Cell In MyPlage

    If Cell.Value = "Ken Ballard" Then
    Range("A" + CStr(Cell.Row) + ":B" + CStr(Cell.Row)).Interior.ColorIndex = 43
    End If


    Next
    End Sub

    Any help would be appreciated! Thanks!

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Conditional Formatting using VBA

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ Reply to Thread

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