Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
A sorted chart?
You have to sort the data in the sheet.
- Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Brad Stone" wrote in message ... 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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sorted Columns | Excel Discussion (Misc queries) | |||
Chart Series Formats lost when list re -sorted | Excel Discussion (Misc queries) | |||
Sorted list | Excel Discussion (Misc queries) | |||
Sorted | Excel Discussion (Misc queries) | |||
sorted | Excel Worksheet Functions |