Solved

Heatmap Graphic Enhanced and Extended

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel 2010 - Delete Row based on date 8 35
Excel Conditional Statements 11 36
New Criteria Prototype 3 18
Copying from excel I am getting extra text 11 39
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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 will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

770 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