Solved

Heatmap Graphic Enhanced and Extended

Posted on 2015-01-27
5
80 Views
Last Modified: 2015-01-28
I have a great little heatmap that Phillip Burton has helped me build.  I have one issue.  The Opal Shape is not properly responding to the sum data in S44 to reflect a color based on a average sum, numeric value with two decimal points.   It should be an easy fix for someone with Macro skills.  I simply need the ability for the right color to show up based on;

0-1.1 = Red
1.1-2=Yellow
2.1-3=Green

That's it!

B.
D--Data-Data-Temp-Cycle-Heatmap-Extended
0
Comment
Question by:Bright01
  • 2
  • 2
5 Comments
 
LVL 21

Assisted Solution

by:Ejgil Hedegaard
Ejgil Hedegaard earned 250 total points
ID: 40573639
Try this.
I named cell S44 to CenterAverage, and used the name in the code to set the colour for Oval1.
Used If..Then..Else instead of Select Case to cover all values.
The code for Oval1 has to run for all changes in the range S32: S37.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 19 And (Target.Row > 31 And Target.Row < 38) Then
    
    With ActiveSheet.Shapes.Range(Array("Arrow" & (Target.Row) - 31)).Fill.ForeColor
        Select Case Target
        Case 1
          .RGB = RGB(0, 255, 0)
        Case 2
          .RGB = RGB(255, 255, 0)
        Case 3
            .RGB = RGB(255, 0, 0)
        End Select
    End With
    
    With ActiveSheet.Shapes.Range(Array("Oval1")).Fill.ForeColor
        If [CenterAverage] <= 1.1 Then
            .RGB = RGB(255, 0, 0)
        ElseIf [CenterAverage] <= 2 Then
            .RGB = RGB(255, 255, 0)
        Else
            .RGB = RGB(0, 255, 0)
        End If
    End With
End If
End Sub

Open in new window

Heatmap-Extended.xlsm
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40573680
Change CASE 1 to CASE 0 TO 1.1
change CASE 2 to CASE 1.1 TO 2
Change CASE 3 to CASE 2 TO 3
0
 

Author Comment

by:Bright01
ID: 40573857
Ejgil,

The code works!

Phillip,

Can you modify the example?  I tried the change but couldn't get it to work.

Thanks guys,

B.
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 250 total points
ID: 40574725
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 19 And (Target.Row > 31 And Target.Row < 38) Then
   
    With ActiveSheet.Shapes.Range(Array("Arrow" & (Target.Row) - 31)).Fill.ForeColor
        Select Case Target
        Case 1
          .RGB = RGB(0, 255, 0)
        Case 2
          .RGB = RGB(255, 255, 0)
        Case 3
            .RGB = RGB(255, 0, 0)
        End Select
    End With
   
    With ActiveSheet.Shapes.Range(Array("Oval1")).Fill.ForeColor
        Select Case [CenterAverage]
        CASE 0 TO 1.1
            .RGB = RGB(255, 0, 0)
        CASE 1.1 TO 2
            .RGB = RGB(255, 255, 0)
        CASE 2 TO 3
            .RGB = RGB(0, 255, 0)
        End Select
    End With
End If
End Sub
0
 

Author Closing Comment

by:Bright01
ID: 40574959
Great job guys.  Both approaches worked and I learned a few new things....thank you for that.  In the end, I went with Phillip's solution because it is simple.... but both were equally effective.

Thanks again,

B.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question