Solved

Heatmap Graphic Enhanced and Extended

Posted on 2015-01-27
5
72 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 20

Assisted Solution

by:Ejgil Hedegaard
Ejgil Hedegaard earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
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 …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now