+ Reply to Thread
Results 1 to 3 of 3

Defining Cell Value Based on Shape Color

  1. #1
    Registered User
    Join Date
    08-27-2014
    Location
    Florida, U.S.
    MS-Off Ver
    2010
    Posts
    20

    Defining Cell Value Based on Shape Color

    Hello,

    As I was watching the election results in the United States, I wanted to have an interactive map where I could click a state and assign the electoral value to either Democrat or Republican. I have a map and have successfully gotten the states to changes colors based on clicking it. What I am looking to do is assign the value to either Democrat or Republican. The code I have is below but I cannot get the cell to update based on the color of the shape. I know something is going wrong with my if statement but before I spend too much more time on it I want to make sure this is even possible.

    Any help is appreciated - just thought this would be cool to have.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Defining Cell Value Based on Shape Color

    What I would do is make a list of all the states somewhere in the workbook and have the routine change not only the color of the state, but also the entry in the list.
    It looks like you already have shapes named for each of the states.

    Put this code in your workbook and run the sub SetUp, thereafter, clicking on one of the states should both change its color and the list of who voted for whom.

    (The attached demo file has only three states)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    08-27-2014
    Location
    Florida, U.S.
    MS-Off Ver
    2010
    Posts
    20

    Re: Defining Cell Value Based on Shape Color

    Thank you for the insight and workbook. Your code led me to the solution I was searching for. I will post the workbook once it is complete.

+ 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. VBA: Change Shape Color based off cell value
    By emmz5d in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2016, 04:35 PM
  2. Changing Color of Shape based on cell value
    By sully8014 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2015, 08:02 AM
  3. Select a shape based on a cell value and update the shape when value changes
    By BigAl99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2013, 12:06 PM
  4. [SOLVED] Change Shape Fill Color Based on Cell Value
    By Justair07 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-28-2013, 09:35 AM
  5. Change Shape Color based on Cell Values
    By obriend in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2013, 03:26 AM
  6. color formatting of shape based on cell value
    By Dave G in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-18-2013, 04:18 AM
  7. Fill Cell with Color from Shape's color code
    By excelnewbie80 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-02-2012, 05:34 PM

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