+ Reply to Thread
Results 1 to 2 of 2

Row Color Forumla

  1. #1
    Registered User
    Join Date
    01-25-2005
    Posts
    8

    Row Color Forumla

    here is a formula that is in use..

    IF( INDIRECT("'Roster1'!A1'")=""," ",INDIRECT("'Roster1'!A1") )

    so.. if A1 is null return "space" else copy A1

    I want to add now..

    if A1 = "STR" turn this row green
    if A1 = "LTR" turn this row blue
    if A1 = "SGE" turn this row red
    else
    leave it, or turn it black

    i looked at conditional formatting.. however not only could i not get it to work, it appears to me it only looks at 1 cell and cant change the whole row color.
    let me know if u have any ideas
    mdpx

  2. #2
    Forum Contributor
    Join Date
    09-05-2004
    Location
    Melbourne
    Posts
    193
    Something like this might help

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error GoTo Finish

    If Left(Target.Address, 2) = "$A" Then
    Select Case UCase(Target.Value)
    Case "STR"
    Target.EntireRow.Font.ColorIndex = 43
    Case "LTR"
    Target.EntireRow.Font.ColorIndex = 41
    Case "SGE"
    Target.EntireRow.Font.ColorIndex = 3
    Case Else
    Target.EntireRow.Font.ColorIndex = 0
    End Select
    End If

    Finish:

    Application.EnableEvents = True

    End Sub

    This will work on any change to a cell in Col A. You didn't specify where the changes occur so change the IF statement to suit. This code needs to be pasted in the sheet code section (right click on the sheet tab and select 'view code')

    HTH

+ 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