xyScatterChart macro works on WinXP Pro & not on WinXP Home?

D

Dennis

I have a ScatterChart macro that works perfectly with Excel2000 on my Win XP Pro
computer. I select two columns and click on the macro and the xyScatterChart is
displayed.

When I moved this exact same code to my new Laptop with Excel2000 and WinXP
Home, the macro would not produce a xyScatterChart but produced a double line
chart with two lines(two sets of points) for the selected two columns instead of
an xyScatterChart.

I can't figure out why the code below works on my WinXP Pro desktop and not the
same on my WinXP Home laptop.

Thanks for any help.

Dennis

====myScatterChart Code======================
Option Explicit
Sub myScatterChart()

'On Error Resume Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim curwk As Worksheet
Dim SS As String
Dim myCell As Range
Dim rng As Range
Dim myName As String
Dim ChartName As String
Dim ii As Long
ii = 0
myName = ""

SS = ActiveSheet.Name
Set rng = Selection
For Each myCell In rng
ii = ii + 1
If Not IsNumeric(myCell.Value) Then myName = myName & myCell.Value
Next myCell

Charts.Add

ChartName = ActiveChart.Name
If myName <> "" And Not myNameExists(myName) Then ActiveChart.Name = myName

With ActiveChart
.ChartType = xlXYScatter
.Location Where:=xlLocationAsNewSheet
.Move After:=Sheets(Sheets.Count)
.PlotArea.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
With .Axes(xlCategory)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
With .Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With

.SeriesCollection(1).Trendlines.Add(Type:=xlLinear, Forward _
:=0, Backward:=0, DisplayEquation:=True, DisplayRSquared:=True).Select
.PlotArea.Select
End With

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top