A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Excel 2007 - problems with macro to change series formula



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old May 18th, 2010, 05:33 PM posted to microsoft.public.excel.charting
Gill L
external usenet poster
 
Posts: 1
Default Excel 2007 - problems with macro to change series formula

Please help! I've just been moved to Excel 2007 and now find that the
wonderful macro below no longer works (the single chart version is still OK).
I have files with 50 charts on a single worksheet (the data is on a separate
tab) and I need to choose which rows to include rather than having an auto
update. The files are accessed from multiple workstations so a macro saved
in the workbook was ideal.
Is there any way I can modify this code to get it working? Thanks in advance.


Sub ChangeSeriesFormulaAllCharts()
''' Do all charts in sheet
Dim oChart As ChartObject
Dim OldString As String, NewString As String
Dim mySrs As Series

OldString = InputBox("Enter the string to be replaced:", "Enter old
string")

If Len(OldString) 1 Then
NewString = InputBox("Enter the string to replace " & """" _
& OldString & """:", "Enter new string")
For Each oChart In ActiveSheet.ChartObjects
For Each mySrs In oChart.Chart.SeriesCollection
mySrs.Formula = WorksheetFunction.Substitute(mySrs.Formula,
OldString, NewString)
Next
Next
Else
MsgBox "Nothing to be replaced.", vbInformation, "Nothing Entered"
End If
End Sub

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.