Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
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

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 461
Default Excel 2007 - problems with macro to change series formula

I've provided a link to an updated add-in to handle this change in a
recent article:

How to Edit Series Formulas
http://peltiertech.com/WordPress/how...ries-formulas/

If you need to put the code into a particular workbook, copy it from the
add-in and paste it into the workbook.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 5/18/2010 12:33 PM, Gill L wrote:
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

  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Excel 2007 - problems with macro to change series formula

Thanks Jon, I installed the Add-In on a private computer and its perfect. I
copied the code text and tried to paste it into my file as a new macro, but
that didnt work because of €˜Invalid Inside Procedure.

After some internet research I thought I needed to create it as a module but
there was a error message when it got to €˜Dim gfrmChgSrsFmla As FChgSrsFmla
about Compile Error: User Defined Type not available.

Sorry, Ive only used very basic macros before so if you could point me to
more instructions that would be really helpful. Thanks again.


"Jon Peltier" wrote:

I've provided a link to an updated add-in to handle this change in a
recent article:

How to Edit Series Formulas
http://peltiertech.com/WordPress/how...ries-formulas/

If you need to put the code into a particular workbook, copy it from the
add-in and paste it into the workbook.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 5/18/2010 12:33 PM, Gill L wrote:
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

.

  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 461
Default Excel 2007 - problems with macro to change series formula

FChgSrsFmla is the user form used to get user input.

It would probably be easier to distribute the whole add-in to anyone who
needs the functionality.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 5/20/2010 5:40 AM, Gill L wrote:
Thanks Jon, I installed the Add-In on a private computer and its perfect. I
copied the code text and tried to paste it into my file as a new macro, but
that didnt work because of €˜Invalid Inside Procedure.

After some internet research I thought I needed to create it as a module but
there was a error message when it got to €˜Dim gfrmChgSrsFmla As FChgSrsFmla
about Compile Error: User Defined Type not available.

Sorry, Ive only used very basic macros before so if you could point me to
more instructions that would be really helpful. Thanks again.


"Jon Peltier" wrote:

I've provided a link to an updated add-in to handle this change in a
recent article:

How to Edit Series Formulas
http://peltiertech.com/WordPress/how...ries-formulas/

If you need to put the code into a particular workbook, copy it from the
add-in and paste it into the workbook.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 5/18/2010 12:33 PM, Gill L wrote:
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

.

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
change series or line color in excel 2007 vba Nick Charts and Charting in Excel 4 April 6th 10 02:31 PM
Macro trust center problems in Excel 2007 David Walker Setting up and Configuration of Excel 1 January 9th 08 01:13 AM
How do I change the legend Series order in Excel 2007? Csmith Excel Discussion (Misc queries) 2 July 20th 07 10:26 PM
How do I change the Series plotting order in Excel 2007? Csmith Excel Discussion (Misc queries) 0 July 20th 07 08:52 PM
Change chart type in single data series, Excel 2007 momof3 Charts and Charting in Excel 3 June 30th 07 02:45 PM


All times are GMT +1. The time now is 01:28 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"