Consulting

Results 1 to 3 of 3

Thread: Solved: Conditional Format for percentage

  1. #1
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location

    Solved: Conditional Format for percentage

    hi there

    I want to format Column CH based on value of percentage in column CI
    Here's the conditions:
    CONDITIONS:
    Percent Colour Format
    0% Brown
    1% - 49.99% Black
    50%-79.9% Red
    80%-99.9% Yellow
    >100% Green

    Thanks for assistance

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Sub test()
    Dim Str As Long

    With ActiveSheet

    For Each c In Intersect(.UsedRange, .Columns("CI")).Cells

    If Len(c.Value) > 0 Then

    If IsNumeric(c.Value) Then

    Select Case c.Value * 100
    Case Is = 0
    .Cells(c.Row, "CH").Interior.ColorIndex = 53
    Case 1 To 49.9
    .Cells(c.Row, "CH").Interior.ColorIndex = 0
    Case 50 To 79.9
    .Cells(c.Row, "CH").Interior.ColorIndex = 3
    Case 80 To 99.9
    .Cells(c.Row, "CH").Interior.ColorIndex = 6
    Case Is > 100
    .Cells(c.Row, "CH").Interior.ColorIndex = 10
    End Select
    End If
    End If
    Next c
    End With
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location
    Hi Bob
    That is wonderful, thank you so much.
    Best regards,
    Harto

Posting Permissions

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