VBA was working in excel 2003, not in excel 2010

JulieSB

New Member
Joined
Jun 4, 2013
Messages
14
The following code was used to create a chart in excel 2003, but doesn't seem to work in excel 2010? When I run the debugger, the line in red below is highlighted. I am a new user of VBA, please help!
Rich (BB code):
Sub TraceXYMulti()


      Dim myCht As Chart
      Dim mySrs As Series, Isrs As Integer
      Dim Npts As Integer, Ipts As Integer
      Dim myBuilder As FreeformBuilder
      Dim myShape As Shape
      Dim Xnode As Double, Ynode As Double
      Dim Xmin As Double, Xmax As Double
      Dim Ymin As Double, Ymax As Double
      Dim Xleft As Double, Ytop As Double
      Dim Xwidth As Double, Yheight As Double
      Dim Xnodes As Double, Ynodes As Double


    
    ActiveSheet.ChartObjects(1).Activate
    ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .Crosses = xlCustom
        .CrossesAt = Sheets("Yield Mix Logic").Range("C2")
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
      
    ActiveSheet.ChartObjects(1).Select
    
      Set myCht = ActiveChart
        
     With myCht
     For x = .Shapes.Count To 1 Step -1
        With .Shapes(x)
        .Delete
        End With
         Next x
    End With
 
Last edited by a moderator:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
HTH. Dave
Code:
With ActiveSheet.ChartObjects(1).Chart
For X = .Shapes.Count To 1 Step -1
With .Shapes(X)
.Delete
End With
Next X
End With
edit: maybe dim "X" as an integer also
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,040
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top