+ Reply to Thread
Results 1 to 2 of 2

Code for Macro for Line-Column 2 axis (y) Graph

Hybrid View

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    Farmington, CT
    MS-Off Ver
    Excel 2003
    Posts
    4

    Code for Macro for Line-Column 2 axis (y) Graph

    Hello,

    I'm an intern at a company right now learning macros for Microsoft Excel. I have many columns of data and my project is to macro them to make many graphs, but for now I'm trying to just make one. I make the graph in the first step and everything looks fine, but then when I run the macro, the graph changes and the secondary y-axis disappears. What's wrong?

    Here's the code:

    Charts.Add
        ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
            "Line - Column on 2 Axes"
        ActiveChart.SetSourceData Source:=Sheets("Monthly").Range( _
            "A9:A157,B9:B157,B165:B313"), PlotBy:=xlColumns
        ActiveChart.Location Where:=xlLocationAsNewSheet
        With ActiveChart
            .HasTitle = False
            .Axes(xlCategory, xlPrimary).HasTitle = False
            .Axes(xlValue, xlPrimary).HasTitle = False
            .Axes(xlCategory, xlSecondary).HasTitle = False
            .Axes(xlValue, xlSecondary).HasTitle = False
        End With
    End Sub
    If someone wants, I'll upload screenshots of how the graphs change.

    Thanks a lot,
    Jack
    Last edited by jackofspades4395; 06-18-2013 at 04:17 PM. Reason: Sorry, updated code 4:13 PM

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Code for Macro for Line-Column 2 axis (y) Graph

    Hi
    is the problem in the custom template you are applying?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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