+ Reply to Thread
Results 1 to 9 of 9

VBA code to tell an object to change colour depending on figure in cell

  1. #1
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Question VBA code to tell an object to change colour depending on figure in cell

    shouldn't be that difficult this one. But basically need a code to tell an object to change fill colour when a cell changes data.

    e.g I want a shape/object to turn red(fill) when the number is 0-49, yellow when the number is 50-69 and Green when the number is 70+

    preferably I would like the object to include a word of text when the cell = 100 e.g. "complete"


    thanks.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA code to tell an object to change colour depending on figure in cell

    What object, and how is the cell populated?
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA code to tell an object to change colour depending on figure in cell

    object as in .... 'a basic shape'

    the cell will be linked to tick boxes so will vary in a percentage rating.. from 0-100 ... or I could easily just make it display 0.50 - 1 etc

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA code to tell an object to change colour depending on figure in cell

    For example:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA code to tell an object to change colour depending on figure in cell

    This is great thanks, ive edited it to be oval 1 on a20 and it does work.. except.. for some reason it wont change automatically when the cell number changes. it only updates when I click run?

  6. #6
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA code to tell an object to change colour depending on figure in cell

    or am I missing something obvious

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: VBA code to tell an object to change colour depending on figure in cell

    To be automatic you would need to use the Change event and check is the correct cell changed and therefore the code should be run.

    Why not use simply cell conditional formatting. You can get non rectangular shapes by masking the cell with a transparent shape.
    Cheers
    Andy
    www.andypope.info

  8. #8
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA code to tell an object to change colour depending on figure in cell

    starting a new thread about something related, ill call it - aesthetic design, appreciate it if you had a look ,your definitely be able to improve it

  9. #9
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA code to tell an object to change colour depending on figure in cell

    in the general thread

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Change Object Colour and Rotation depending on Cell Value
    By batchy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2014, 05:45 AM
  2. [SOLVED] VBA to immediately change the colour of a cell depending on the code placed in another cel
    By Phil Payne in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-13-2013, 01:15 PM
  3. Replies: 1
    Last Post: 06-22-2012, 10:54 AM
  4. How to change a cell colour depending an a different cells value?
    By abb16ott in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 10-23-2009, 04:05 AM
  5. change the colour of text in cell for minus figure
    By Dorn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2005, 03:30 PM

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