Solved

Heatmap Graphic Enhanced and Extended

Posted on 2015-01-27
5
82 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 23

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

632 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