Customizing Charts in VBA

dan03uk

New Member
Joined
Mar 17, 2009
Messages
33
I was wondering if there is away of creating a code using VBA that would exclude data when it has a value of 0 from the graph. This is because I have an ever changing set of data but values of 0 are not needed for the scatter graph.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Any reason you can't just make a formula =IF(A1=0,NA(),A1) and then plot those values instead? NA() won't plot, and that will solve your problem without a macro.
 
Upvote 0
Hi Dan

Welcome to the Board

If the new range doesn't suit hit the old one with a macro

Code:
Sub Clear0s()
Dim my, c As Range
Set my = ActiveSheet.Range("A1:H80")
For Each c In my
    If c.Value = 0 Then c.FormulaR1C1 = "=NA()"
Next c
End Sub

You'll need to be adjusting the ranges and that but it should fair you well

All the best


Dave
 
Upvote 0

Forum statistics

Threads
1,202,977
Messages
6,052,890
Members
444,608
Latest member
Krunal_Shah

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