I've got a macro that's searching a spreadsheet and pulling off data I want, and I want to put it into a bar graph with a categorical axis going vertical (Truck 1, Truck 2, etc.). Is there a way to either a) build arrays and then use them as the chart data with SetSourceData, or b) copy the information to a few random columns and use SetSourceData on those cells, so that I can get a categorical axis? Hope this makes sense.
Currently I have the document searching for my information, copying it to 2 random columns in the worksheet, then defining my ranges. But the categorical axis is coming up as 1,2,etc. :
Sheets("Competitive Position").Shapes("Chart 19").Select
Dim Range1 As Range
Dim Range2 As Range
Dim myrange As Range
Set Range1 = Sheets("Competitive Position").Range(Cells(2, 15), Cells(2 + NumCols, 15))
Set Range2 = Sheets("Competitive Position").Range(Cells(2, 16), Cells(2 + NumCols, 16))
Set myrange = Union(Range1, Range2)
ActiveChart.SetSourceData Source:=myrange
Any help would be greatly appreciated!
Currently I have the document searching for my information, copying it to 2 random columns in the worksheet, then defining my ranges. But the categorical axis is coming up as 1,2,etc. :
Sheets("Competitive Position").Shapes("Chart 19").Select
Dim Range1 As Range
Dim Range2 As Range
Dim myrange As Range
Set Range1 = Sheets("Competitive Position").Range(Cells(2, 15), Cells(2 + NumCols, 15))
Set Range2 = Sheets("Competitive Position").Range(Cells(2, 16), Cells(2 + NumCols, 16))
Set myrange = Union(Range1, Range2)
ActiveChart.SetSourceData Source:=myrange
Any help would be greatly appreciated!