![]() |
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! |
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! |
All times are GMT +1. The time now is 12:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com