Thread: A sorted chart?
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Brad Stone Brad Stone is offline
external usenet poster
 
Posts: 1
Default A sorted chart?

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.SetSour ceData
Source:=Sheets("Sheet1").Range(Sheets("Sheet1").Ce lls(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!