Results 1 to 4 of 4

Excel 2007 : VBA XY scatter plot problems

Threaded View

  1. #1
    Registered User
    Join Date
    05-29-2009
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    2

    VBA XY scatter plot problems

    Hi all,

    I am new to VBA, and I'm using Excel 2007 to do some automated graphing for work. Anyhow, I am having heck of a time getting a macro I am working on to do what I want. Here's what's happening:

    1. I record the macro - I select both columns in the attached sheet - Go to insert chart- select the XY scatter plot - and it gives me a linear graph with the XY axis in the right place (A is X axis, B is Y axis). However, when I run this macro, it totally screws up the axis variables, and my graph comes out incorrect - I can eve tell where it's getting mixed up.

    I realize at this point the chart wizard would be appropriate, but I need automation to be incorporated within this sheet. I am writing this macro because I will need to append this graph with new curves as I bring more columns of data in, but I can't even get it to do a simple plot yet - Any ideas?

    Attached is the document

    Here is the code for reference:

    Sub Macro4()
    
        Columns("A:B").Select
        ActiveSheet.Shapes.AddChart.Select
        ActiveChart.SetSourceData Source:=Range("'500mW impedance'!$A:$B")
        ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
    
    End Sub



    Thanks!

    Jordan
    Attached Files Attached Files
    Last edited by jordan_schultz; 05-30-2009 at 07:58 PM.

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