Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro work in Excel 2003 but not Excel 2007

This code works in Excel 2003, but gives me a Type Mismatch error in Excel
2007.

Sub aaa()

Dim submissionXValsRange
Set submissionXValsRange = Sheets("Sheet1").Range("A1:A5")

Dim submissionYValsRange
Set submissionYValsRange = Sheets("Sheet1").Range("B1:B5")

' Actual submission values scatter chart
Dim MyNewSrs As Series
Set MyNewSrs = Sheets("Chart1").SeriesCollection.NewSeries
With MyNewSrs
.Name = "Data"
.Values = submissionYValsRange
.XValues = submissionXValsRange
.Trendlines.Add Type:=xlLinear, Name:="Linear Trendline ",
Forward:=2000, DisplayEquation:=True
End With

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Macro work in Excel 2003 but not Excel 2007

Declare your ranges 'As Range' and it will work.

That's kind of far to be extrapolating, isn't it?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Shawn M." wrote in message
...
This code works in Excel 2003, but gives me a Type Mismatch error in Excel
2007.

Sub aaa()

Dim submissionXValsRange
Set submissionXValsRange = Sheets("Sheet1").Range("A1:A5")

Dim submissionYValsRange
Set submissionYValsRange = Sheets("Sheet1").Range("B1:B5")

' Actual submission values scatter chart
Dim MyNewSrs As Series
Set MyNewSrs = Sheets("Chart1").SeriesCollection.NewSeries
With MyNewSrs
.Name = "Data"
.Values = submissionYValsRange
.XValues = submissionXValsRange
.Trendlines.Add Type:=xlLinear, Name:="Linear Trendline ",
Forward:=2000, DisplayEquation:=True
End With

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
Excel 2003 help doesn't work. I got both Excel 2003 and 2007 insta Kenneth Andersen Excel Discussion (Misc queries) 0 February 16th 10 10:44 AM
SUMIF formula works in Excel 2003, does not work in Excel 2007 Harry Excel Discussion (Misc queries) 3 April 24th 09 02:33 PM
Make Excel 2007 work like 2003 jgcwustl New Users to Excel 1 January 28th 08 09:50 PM
Opening Excel 2003 file in Excel 2007: Links do not work Roshan Q Excel Discussion (Misc queries) 5 January 10th 08 10:24 PM
Embedded Excel 2003 spreadsheet in web page won't work with Excel 2007 Ed Flecko Excel Discussion (Misc queries) 0 August 27th 07 09:01 PM


All times are GMT +1. The time now is 08:58 AM.

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

About Us

"It's about Microsoft Excel"