PDA

View Full Version : CategoryNames or SetSourceData on Excel VBA 2013



GraceOC
03-05-2015, 03:04 AM
Hi,


I have VBA code that refreshes a chart when a sheet is activated. It uses the following:
Worksheets(sChartsWorksheets).ChartObjects(sBenefitChartObject).Activate
ActiveChart.SetSourceData Source:=Evaluate(sBenefitDataRange)
The bits in brackets all work fine (watch window/mouse over gives the correct information).


On Excel 2010, this works fine, but on Excel 2013, it's not updating the category labels on the chart; they remain as numbers (simply 1, 2, 3...)


I have also tried specifically targeting the labels:
With Worksheets(sChartsWorksheets).ChartObjects(sBenefitChartObject).Chart
With .Axes(xlCategory)
.CategoryType = xlCategoryScale
.CategoryNames = Worksheets("! Prioritisation").Range("CH35:CH78")
End With
End With


Again, nothing happens when I run this on Excel 2013.


Anyone had a similar issue and/or know how to fix it?


Thanks in advance.