+ Reply to Thread
Results 1 to 2 of 2

switch row/column graph vba

  1. #1
    Registered User
    Join Date
    03-28-2014
    Location
    Peoria, IL
    MS-Off Ver
    Excel 2010
    Posts
    6

    switch row/column graph vba

    Right now I am able to create the chart, but I am having trouble switching row/column in the graph. The following code works, except for PlotBy:=xlColumns. Any help with be truly appreciatied!
    <html>
    Worksheets("CreateTripleMFile").Shapes.AddChart(xlColumnClustered, Left:=Worksheets("CreateTripleMFile").Range("j11").Left, Top:=Worksheets("CreateTripleMFile").Range("o11").Top, _
    Width:=Worksheets("CreateTripleMFile").Range("j11:O24").Width, Height:=Worksheets("CreateTripleMFile").Range("j11:j24").Height).Select
    Set Rng1 = Worksheets("CreateTripleMFile").Range("p1:r4")
    Set rng2 = Worksheets("CreateTripleMFile").Range("d1:d4")
    With ActiveChart

    .SetSourceData Source:=Union(Rng1, rng2) _
    PlotBy:=xlColumns

    .SetElement (msoElementChartTitleAboveChart)

    .ChartTitle.Caption = "SituationalResourceCodes"
    .Legend.Position = xlBottom
    .Legend.Left = 0.209
    .Legend.Width = 325
    .Legend.Height = 24
    .SeriesCollection(1).ChartType = xlColumnClustered

    End With
    </html>
    Last edited by SpaceRocksMars; 05-02-2014 at 01:41 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: switch row/column graph vba

    Missing comma.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA code to switch graph type at click of a button
    By no.18shirt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2013, 05:05 AM
  2. Graph that can switch data sets?
    By tokyojo in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-22-2008, 11:57 AM
  3. Graph that can switch data sets?
    By thedon_1 in forum Excel Charting & Pivots
    Replies: 14
    Last Post: 09-20-2007, 03:28 PM
  4. Switch row with column?
    By jason57gizmo in forum Excel General
    Replies: 1
    Last Post: 01-21-2006, 12:10 PM
  5. Toggle on/off switch for x-y graph
    By Brad in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 08-18-2005, 11:05 PM

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