Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Redefining chart series

I have the following macro that pulls out references to external files and
references the current sheet. I'm sure it's a simple fix to someone, but I
can't get it.

Sub SeriesFix()
Dim aWB As Workbook
Dim aWS As Worksheet
Dim objCht As Object
Dim chtSeries As Series
Dim sName As String
Dim sReplace As String
Dim sTemp As String

'This sub will remove all references to files on other servers within the
'chart series

Set aWB = ActiveWorkbook

For Each aWS In aWB.Worksheets
Debug.Print aWS.Name
sName = "*" & aWS.Name & "*"
sReplace = "'" & aWS.Name & "'!"
For Each objCht In aWS.ChartObjects
With objCht.Chart
Debug.Print .Name
For Each chtSeries In .SeriesCollection
With chtSeries
If .Formula Like sName Then
sTemp = Replace(.Formula, _
sReplace, "")
Debug.Print sTemp, .Formula
chtSeries.Formula = sTemp <~~~~~doesn't like this

End If
End With
Next chtSeries
End With
Next objCht
Next aWS
End Sub

I'm guessing I need to change the X and Y parts of the series. Thanks for
any assistance.

Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Redefining chart series

Never mind. For some reason I thought it was looking at other workbook when
the worksheet name was defined as the workbook name I extracted the worksheet
from. No wonder it didn't work right.

Thanks anyway.

Barb

"Barb Reinhardt" wrote:

I have the following macro that pulls out references to external files and
references the current sheet. I'm sure it's a simple fix to someone, but I
can't get it.

Sub SeriesFix()
Dim aWB As Workbook
Dim aWS As Worksheet
Dim objCht As Object
Dim chtSeries As Series
Dim sName As String
Dim sReplace As String
Dim sTemp As String

'This sub will remove all references to files on other servers within the
'chart series

Set aWB = ActiveWorkbook

For Each aWS In aWB.Worksheets
Debug.Print aWS.Name
sName = "*" & aWS.Name & "*"
sReplace = "'" & aWS.Name & "'!"
For Each objCht In aWS.ChartObjects
With objCht.Chart
Debug.Print .Name
For Each chtSeries In .SeriesCollection
With chtSeries
If .Formula Like sName Then
sTemp = Replace(.Formula, _
sReplace, "")
Debug.Print sTemp, .Formula
chtSeries.Formula = sTemp <~~~~~doesn't like this

End If
End With
Next chtSeries
End With
Next objCht
Next aWS
End Sub

I'm guessing I need to change the X and Y parts of the series. Thanks for
any assistance.

Barb Reinhardt

Reply
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
excel chart maximum series should more than 255 series kameking Charts and Charting in Excel 5 August 22nd 10 10:52 AM
User Selectable Series and Number of Series for Line Chart Dave in NJ Charts and Charting in Excel 2 February 23rd 09 12:18 AM
how to plot column chart with one series against multiple series. svenkateshmurthy Charts and Charting in Excel 2 October 16th 07 09:09 PM
Add Series to a chart failure and Disappearing Series GEOTEC Excel Programming 0 October 26th 05 04:13 PM
chart data series -- plot a table as a single series hjc Charts and Charting in Excel 7 September 20th 05 05:52 PM


All times are GMT +1. The time now is 06:16 AM.

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"