Thank you in advance because I have been stuck for 2 hours on this issue. The process formats data into a Pivot table because of X/Y needs to be read / formatted. Everything for the most part works correctly except when I want to format the actual graph. The legend, font, title, etc won't change and it appears to be the ActiveChart. It works for everything else.
This leaves me a little confused, why I can't format the graph. Maybe I need to set focus? Again, thank you in advance. Public Sub CreateChart(chtName As String, titleName As String, filter As String) ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _ "qry_OPRiskBusiness!R1C1:R97C5").CreatePivotTable TableDestination:= _ "[TestExport.xls]qry_OPRiskBusiness!R1C8", TableName:=chtName, _ DefaultVersion:=xlPivotTableVersion10 Sheets("qry_OPRiskBusiness").Select With ActiveSheet.PivotTables(chtName) .ColumnGrand = False .EnableDrilldown = False .RowGrand = False .SaveData = False .RepeatItemsOnEachPrintedPage = False End With ActiveSheet.PivotTables(chtName).AddFields _ RowFields:=Array("Year", "Quarter"), _ ColumnFields:="Business", PageFields:="Region" ActiveSheet.PivotTables(chtName).PivotFields ("NetAmount_USD1").Orientation = xlDataField Charts.Add ActiveChart.Location Where:=xlLocationAsNewSheet ActiveWorkbook.ShowPivotTableFieldList = False ActiveChart.ChartType = xlAreaStacked ActiveChart.Location Where:=xlLocationAsNewSheet With Selection.Border .Weight = xlHairline .LineStyle = xlAutomatic End With ActiveChart.HasPivotFields = False ActiveChart.PlotArea.Select ActiveChart.Axes(xlValue).MajorGridlines.Select With Selection.Border .ColorIndex = 57 .Weight = xlHairline .LineStyle = xlDot End With 'ActiveChart.PlotArea.Select With Selection.Border .ColorIndex = 16 .Weight = xlThin .LineStyle = xlContinuous End With '============================================== 'Issue begins here ' With Selection.Font ' .Name = "Arial" ' .FontStyle = "Regular" ' .Size = 9 ' End With With ActiveChart '.HasTitle = True '.ChartTitle.Characters.Text = "Losses By " & titleName & " (MM)" '.HasLegend = True '.Legend.Select 'Selection.Position = xlBottom '.Axes(xlValue).Select 'Selection.TickLabels.NumberFormat = "$#,##0.0" '.Axes(xlCategory).Select End With With Selection '.MajorTickMark = xlOutside '.MinorTickMark = xlNone '.TickLabelPosition = xlLow End With 'With Selection.Interior ' .ColorIndex = 2 ' .PatternColorIndex = 1 ' .Pattern = xlSolid 'End With 'ActiveChart.Legend.Select 'Selection.AutoScaleFont = True 'Issue end here '============================================================ Sheets("qry_OPRiskBusiness").Select ActiveSheet.PivotTables(chtName).PivotFields("Region").CurrentPage = filter End Sub --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,500 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---