+ Reply to Thread
Results 1 to 7 of 7

Is it possible, using VBA, to fill a shape based on a different cell value

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    CLT
    MS-Off Ver
    Excel 2007
    Posts
    3

    Is it possible, using VBA, to fill a shape based on a different cell value

    Hi everyone,

    I’m new to both this forum and using VBA (my limited experience consist of recording a few macros and making minor tweaks to them).
    I’ve come across a problem that I can’t use the record button for:

    I want to fill a Shape with Color based on the contents of a certain cell.

    For Example:
    If cell E1 =1 then fill shape "Flowchart: Process 1" with Yellow and if E1 = 0 then fill shape "Flowchart: Process 4" with Red.
    And
    If cell H1=1 then fill shape "Flowchart: Process 2" with Yellow and if E1 = 0 then fill shape " Flowchart: Process 3" with Red.

    Is there a simple way to code this?

    Thanks,
    SDG2012

  2. #2
    Forum Contributor
    Join Date
    02-24-2011
    Location
    Belfast, N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    103

    Re: Is it possible, using VBA, to fill a shape based on a different cell value

    Hi SDG

    Can you post a copy of your workbook with the Flowchart shapes in it?

    Mowgli

  3. #3
    Registered User
    Join Date
    01-30-2013
    Location
    CLT
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Is it possible, using VBA, to fill a shape based on a different cell value

    Here's the example file.

    Thanks again,
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    02-24-2011
    Location
    Belfast, N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    103

    Re: Is it possible, using VBA, to fill a shape based on a different cell value

    SDG,

    Is this the sort of thing you are wanting?

    Mowgli

    Flowchart Colours.xlsm

  5. #5
    Forum Contributor
    Join Date
    02-24-2011
    Location
    Belfast, N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    103

    Re: Is it possible, using VBA, to fill a shape based on a different cell value

    Post this code into your "ThisWorkbook" section

    Please Login or Register  to view this content.
    I have assumed that you meant cell H1 to control the colour of Flowchart: Process 3 as opposed to E1 changing it to red as E1 would then make both boxes red. If I am wrong its easy changed

    Mowgli

  6. #6
    Registered User
    Join Date
    01-30-2013
    Location
    CLT
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Is it possible, using VBA, to fill a shape based on a different cell value

    This is exactly what I needed. It worked perfectly.

    thanks so much for your help!

  7. #7
    Forum Contributor
    Join Date
    02-24-2011
    Location
    Belfast, N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    103

    Re: Is it possible, using VBA, to fill a shape based on a different cell value

    Happy to be of help

    Don't forget to mark your thread SOLVED

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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