+ Reply to Thread
Results 1 to 4 of 4

How to hide shapes based on numerous cell values

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, Texas
    MS-Off Ver
    Office 365 2013
    Posts
    7

    How to hide shapes based on numerous cell values

    I have a tricky one. I am creating an org chart in powerpoint and have about 400 different boxes that will need to get various color coded shapes in them. I am planning on pasting linked metafiles and would like the shapes to be dynamic and change as I make edits to the associated spreadsheet. I have a spreadsheet with about 400 lines and within each line are 10 different scenarios, each column and each line will get a 0's or -1's.

    I am trying to write code that will automatically hide Oval 1 when Cell A1 = 0 and unhide i when A1 = -1.



    A B C D E F G H I J 1 2 3 4 5 6 7 8 9 10
    1 -1 0 0 0 -1 0 0 0 1 0 OVAL 1 Oval 2 ...
    2 0 0 -1 -1 0 1 Oval 11 oval 12 ... ... ... ... ... ... ... ...

    I am able ot do it pretty easily with the following code, but always have trouble with the references and having the loop work properly. (ie, had the idea to calculate the oval # by doing Row of the oval * 10 + the column (eg, Oval Row 1*10+column2 = Oval 12).

    Basically want to do the following code on each of the 10 scenarios and hide/unhide the associated ovals in the adjacent columns.

    Any ideas?

    #
    Please Login or Register  to view this content.
    #

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to hide shapes based on numerous cell values

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    sample book would help determine how best to tackle your particular scenario
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    10-15-2013
    Location
    Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: How to hide shapes based on numerous cell values

    1. I created a table from column A to J, rows 1 to 10; placing "=0" in each cell (you need the equal sign since you are using the calculate event trap and need to have a formula).
    2. I created a grid of ovals named across "Oval 1" to "Oval 10" (in row 1), "Oval 11" to "Oval 20" (row 2), etc to 10 rows.
    3. I added the following code in the Worksheet_Calculate event trap.
    4. Anytime I change the value in the table to "=-1" (actually any non-zero value), the corresponding oval is hidden. Change back to "=0", and it appears.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-15-2013
    Location
    Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: How to hide shapes based on numerous cell values

    This is another method, a little more dynamic (and moved to Worksheet_Change event to remove the need for "=").
    In this version, simply change the constants to meet the needs of your data grid (the oval names still need to match the number of data points):
    Please Login or Register  to view this content.

+ 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. Colour shapes based on cell values in a lookup
    By aimone111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2015, 09:57 PM
  2. Hide / Unhide Shapes Based on Cell Selection
    By ckoolsurf in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2015, 05:33 PM
  3. VBA to Show/Hide multiple shapes based on cell values
    By Mike_Taylor16 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2013, 03:29 PM
  4. Change color of shapes based on cell values.
    By rkostner in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-24-2013, 05:55 PM
  5. Hide Numerous Rows if a Cell value is 0
    By Sky188 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-20-2013, 11:59 AM
  6. Shapes based on Cell Data, Golf Score card data that shows shapes around scores
    By BiggDC1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2012, 12:42 PM
  7. Hide shape based on cell value - For mutliple shapes
    By [Jimmy] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2012, 09:36 AM

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