+ Reply to Thread
Results 1 to 2 of 2

VBA - Traffic light Icons (Conditional Formatting) -Trigger from mixed text/number results

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    VBA - Traffic light Icons (Conditional Formatting) -Trigger from mixed text/number results

    Please Login or Register  to view this content.
    Hi,

    Aim

    I want to use traffic lights (less obtrusive than full shading) to highlight these 3 results in a column (range O6:O37 in my spreadsheet), creating an easy to see dashboard.

    The traffic light to be in the same cell, not in an adjacent column.

    Column Contents i.e. Format Desired Traffic Light
    Any date* Number Green
    Blank Cell Number/text Amber
    "Rejected" Text Red

    Attempts/Difficulties so far with "Edit Formatting Rule" box (Conditional Formatting)


    a) To set the Conditional formatting I recorded a Macro following my mouse strokes:
    • Conditional Foramtting/Manage Rules/Edit Rules/Edit Formatting Rule box
    • Select a Rule Type" - I selected "format all cells based on their values".
    • Icon set (traffic lights).
    Result - This seems to default to Applying the default Top third (green), Middle third (Amber), Bottom third (Red) split to the data they are considering (underlying number which Excel holds for a date). Cells with "Rejected" or just no text (blank) were just ignored.

    b) To set the Conditional formatting I recorded the same Macro as above,
    • Select a Rule Type - "format all cells based on their values"
    • Icon set (traffic lights)
    • but changed the "Type" for Textual results (blank) or "Rejected" to "Formula" telling it to apply amber/red respectively when cells contain these texts.
    Result - Same as above.

    c) To set the Conditional formatting I recorded the same Macro as above,
    • Select a Rule Type - "Use a formula to determine which cells to format"
    • R
    Result - Works, but doesn't allow trafflic light icon formatting. Only shading.


    VBA????

    d) VBA code Attempt
    • Result - Same as above.
    • N
    B - What does "Operator = 7" mean - which I turned off.


    Please help!

    My VBA code so far is below:

    Usual format, I have highlighted comments/non-functioning code in green

    Please Login or Register  to view this content.
    Thanks!
    Last edited by phil34; 05-07-2013 at 09:48 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VBA - Traffic light Icons (Conditional Formatting) -Trigger from mixed text/number res

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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