+ Reply to Thread
Results 1 to 2 of 2

Using a Chart Template via VBA and referencing the Active Worksheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Using a Chart Template via VBA and referencing the Active Worksheet

    Greetings
    I am trying to get VBA to use a chart template instead of the 3DPie it is currently using. I am also wanting it to reference source data on the active worksheet instead of coding it as part of the macro.

    Right now, this is what I have been able to cobble together but I am having to manually change the chart type and the source range.


        Range("AA13:AB15").Select
            ActiveSheet.Shapes.AddChart.Select
            ActiveChart.ChartType = xl3DPie
            ActiveChart.SetSourceData Source:=Range("'On Your Six 032212'!$AA$13:$AB$15")
    Any help would be greatly appreciated.

    Thanks
    Jacob Albers
    Excel 2003 & 2010

  2. #2
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Using a Chart Template via VBA and referencing the Active Worksheet

    I will attempt to do this again. I continued to search for a solution to the problem above and finally found what I was looking for, here is the solution in case anyone else gets stumped in this situation:

        Range("AA17:AB19").Select
            ActiveSheet.Shapes.AddChart.Select
            ActiveChart.ApplyChartTemplate ("Full Path\Template.crtx")
            ActiveChart.SetSourceData Source:=ActiveSheet.Range("$AA$17:$AB$19")
    The solution was to let it know I was trying to apply a template, give it the full path to the template and finally to get the active sheet worked on, tell it to use the 'active sheet'.

+ 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