byronwall / bUTL

Excel add-in with helpers for charting, formatting, and general pain points
http://byroni.us/bUTL
MIT License
16 stars 3 forks source link

bUTLChartSeries - Name fails on non-Range name #33

Open byronwall opened 9 years ago

byronwall commented 9 years ago

The bUTLChartSeries class exists to provide an interface to interpret the the SERIES formula and get ranges for the XValues, Values, and Name. This provides the basis for other dependent features (e.g. Flip XY) where you need Ranges in order to make changes. The underlying Excel Series class is deficient in this regard.

This bUTLChartSeries class fails when the Name of a chart is a string and not an actual Range. This can be easily done by entering ="TEST" into the Select Data interface. The problem is that there is no underlying Range for the name which is the underlying type of Name.

The same failure will happen if an array is used instead of a Range for any of the other fields.

Somehow this class needs to be able to handle these different scenarios. They are common enough that they need to be supported. This will likely require tracking what type of data is underlying and providing some sort of Variant or other variable type to handle the different possibilities.

It might also be possible to simply store the string part of the SERIES formula and then dump that back in if the object is not defined.

Line where issues occur: https://github.com/byronwall/bUTL/blob/master/src/code/bUTLChartSeries.vba#L123

byronwall commented 8 years ago

There are a number of places where this issue pops up. There have been some changes that looked to address this. There are still ongoing problems when the Name is determined from a Range that is multi-cell. This breaks code in most places. Ideally, this should track a separate property for the Name text. That method can deal with all the possible ways to convert the name into a string for others to use. This is preferred over dealing with it in all the difference places.

This issue will be updated with the specific locations where the Series Name is being used and provide a path to make those spots robust to different types of Name definitions.