LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 22
Default Abstracting Error Bar Data From Charts

I have a series of charts that I build each day and mail out to
multiple recipients. Some of them would like to see the underlying
data. Rather than send the data files, I have provided them with a
macro to abstract the data from the charts they already receive, and
to set the source for the chart to that abstracted data.

Fine, except for the error bars. The charts contain custom error bars
on one series, and I'd like to abstract those from the charts too. But
I can not find the place in the object model where the data is
stored.

I know that the Chart.SeriesCollection will tell me whether there are
error bars, through the HasErrorBars property, and I know there is an
ErrorBars object, but it doesn't appear to contain the data. The Excel
help, as is invariably the case with Excel 2007, is absolutely
useless.

Anyone know how I get to this data?

--------

The full macro, in case anyone would have a use for it, is:

Option Explicit
Public Sub Extract_Data_From_Charts()
Dim iRows As Integer
Dim iCell As Integer
Dim iChart As Integer
Dim iChartObjects As Integer
Dim iSeries As Integer
Dim i As Integer

Dim chtChart As ChartObject
Dim shtSheet As Object

Dim strSheetName As String

Dim X As Object

iChart = 1
While iChart <= ActiveWorkbook.Charts.Count
' Calculate the number of rows of data.
Set shtSheet = ActiveWorkbook.Charts(iChart)
For iChartObjects = 1 To shtSheet.ChartObjects.Count
Set chtChart = shtSheet.ChartObjects(iChartObjects)
iRows = UBound(chtChart.Chart.SeriesCollection(1).Values)
strSheetName = shtSheet.Name
Worksheets.Add.Move After:=shtSheet
i = InStrRev(strSheetName, "Chart")
If i 28 Then
i = 28
End If
If i = 0 Then
strSheetName = Left(strSheetName, 28) & " " &
iChartObjects
Else
strSheetName = Left(strSheetName, i - 1) & "(" &
iChartObjects & ")"
End If
ActiveSheet.Name = strSheetName
Worksheets(strSheetName).Cells(1, 1) = "X Values"

' Write x-axis values to worksheet.
''' For iSeries = 1 To
shtsheet.ChartObjects(iChartObjects).Chart.SeriesC ollection.Count
With Worksheets(strSheetName)
.Range(.Cells(2, 1), .Cells(iRows + 1, 1)) = _

Application.Transpose(chtChart.Chart.SeriesCollect ion(1).XValues)
chtChart.Chart.SeriesCollection(1).XValues =
Worksheets(strSheetName).Range(.Cells(2, 1), .Cells(iRows + 1, 1))
End With

' Loop through all series in the chart and write their values
to
' the worksheet.
iCell = 2
For Each X In chtChart.Chart.SeriesCollection
Worksheets(strSheetName).Cells(1, iCell) = X.Name

With Worksheets(strSheetName)
.Range(.Cells(2, iCell), .Cells(iRows + 1, iCell))
= Application.Transpose(X.Values)
X.Values =
Worksheets(strSheetName).Range(.Cells(2, iCell), .Cells(iRows + 1,
iCell))
iCell = iCell + 1
End With
Next
Next iChartObjects
iChart = iChart + 1
Wend
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Black triangles on error bar charts in Excel 2007 tcek Charts and Charting in Excel 3 March 18th 09 09:53 PM
Abstracting text from WORD into Excel Robin Clay Excel Discussion (Misc queries) 2 July 11th 06 04:34 PM
Abstracting text Bill Ridgeway Excel Discussion (Misc queries) 3 May 25th 06 04:34 PM
charts.add error Ribeye Excel Discussion (Misc queries) 2 April 13th 06 07:01 PM
Percentage rounding error in charts Tracey Excel Discussion (Misc queries) 4 May 14th 05 04:01 AM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"