Sparklines

dpotta

New Member
Joined
Aug 16, 2011
Messages
29
9


Longshot:

This is a screen shot of part of a dynamic dashboard. Is there a method, VBA or otherwise for hiding the sparkline if the value in the cell to its left is zero?

Many thanks

D
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi,

The picture didn't make it. However, something like this might work:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    Application.EnableEvents = False
    On Error GoTo err
    If Not Intersect(Target, Columns("I:I")) Is Nothing Then
        If Target = 0 Then
            Target.Offset(0, 1).SparklineGroups.Clear
        Else
            Target.Offset(0, 1).SparklineGroups.Add Type:=xlSparkLine, _
                SourceData:=Target.Offset(0, -2).Resize(1, 3).Address
        End If
    End If
err:
    Application.EnableEvents = True
End Sub
I have assumed the possible zero value will be in column I and that the sparklines data will be in columns G to I and the sparklines in J.
If the value in column I is changed then it inserts sparklines if the value is non-zero and deletes them otherwise.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top