There are hundreds of excel files and I need to go through each of them and create some reports and graphs based on the content of them. However, it's extremely difficult to debug with the built-in excel vba debugger. Also, when the filename has a "-" in it, the macro stops working. How do I fix this? Below is the full code of the macro.
Sub ApplyLabelsAndClearZeros(ByVal chrt As Chart)
Dim ser As Series
For Each ser In chrt.SeriesCollection
ser.ApplyDataLabels
Dim pnt As Point
For Each pnt In ser.Points
If pnt.DataLabel.Text = "0" Then
pnt.HasDataLabel = False
Else
pnt.DataLabel.ShowPercentage = True
pnt.DataLabel.ShowCategoryName = True
End If
Next
Next
End Sub