A sorted chart?

B

Brad Stone

Hi all -

I'm new to VBA in Excel. I have a chart on a Worksheet. And in my VBA
code I tell it where to grab data from:

Worksheets("REPORT").ChartObjects(1).Chart.SetSourceData
Source:=Sheets("Sheet1").Range(Sheets("Sheet1").Cells(ListBox1.ListIndex
+ 2, 2), Sheets("Sheet1").Cells(ListBox1.ListIndex + 2, numofCols + 1)),
PlotBy:=xlRows


Yikes. That's one long statement. It grabs a row from "Sheet1" to fill
the chart on sheet "REPORT". It works. But I need the data to be
sorted so that the graph looks good (i.e. I want the biggest bars to be
on the left and then taper down). Is there a way to instruct the chart
to sort the data? Or maybe there's a way to tell SetSourceData to sort
it?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top