Results 1 to 6 of 6

VBA Error when running macro

Threaded View

willist VBA Error when running macro 07-24-2012, 12:52 PM
vandan_tanna Re: VBA Error when running... 07-24-2012, 01:47 PM
willist Re: VBA Error when running... 07-24-2012, 03:54 PM
JosephP Re: VBA Error when running... 07-24-2012, 03:57 PM
willist Re: VBA Error when running... 07-24-2012, 04:26 PM
vandan_tanna Re: VBA Error when running... 07-24-2012, 04:35 PM
  1. #1
    Registered User
    Join Date
    07-19-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    13

    VBA Error when running macro

    Greetings,

    Could someone please tell me why I am getting an error. I used the "Record Macro" to capture a few things and then I added some of my own stuff. The macro fails almost immediately. Why is this?

    Also, all the columns in the chart are dynamic ranges.

    here is the macro code. it just starts the creation of a graph.
    Sub Macro()
    '
    ' Test Macro
    '
    
    '
        ActiveSheet.Shapes.AddChart.Select
        ActiveChart.ChartType = xlLine
        ActiveChart.PlotArea.Select
        Application.CutCopyMode = False
        ActiveChart.SeriesCollection(1).Delete
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(1).Name = "=""Power"""
        ActiveChart.SeriesCollection(1).Values = "==Fordat.xlsm!Power"
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(2).Name = "=""Amp Hours"""
        ActiveChart.SeriesCollection(2).Values = "==Fordat.xlsm!Amp_Hours"
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(3).Name = "=""Vbatt"""
        ActiveChart.SeriesCollection(3).Values = "==Fordat.xlsm!Vbatt"
        ActiveChart.SeriesCollection(3).XValues = "==Fordat.xlsm!Time"
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(4).Name = "=""Ibatt"""
        ActiveChart.SeriesCollection(4).Values = "==Fordat.xlsm!Ibatt"
    End Sub
    Here are pictures of the error. I have also included the excel file.
    error.JPGerror2.JPG

    Thanks,
    Willis
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1