Greetings all,
I have nothing but utter respect for you all that know the answers to these questions. I am a complete newbit at VBA and pivot tables and the like so please bear with me until I am appropriate indoctrinated.
My Question:
I have a series of pivot tables that pull from a singular data source that is currently located w/in the same workbook. Each table has it's own tab and for the most part the charts associated w/ them are very simple and canned w/ no fancy formatting. However, later on I have PT's that chart using the Line-Column Chart and are Macro'd to reformat to a more eye pleasing appearance. This all works like a charm until I change the data series within the PT that I wish to peruse. I get an error and a request to debug. I can click to the next tab and back to that tab and my macros kick in and reformat/refresh the data beautifully with not problem. It is only on selection of a different series of data in one table that it goes nutz.
Also to note, I initially wrote this gem at home w/ Excel 2002 where it worked great not matter what button I poked. I sent it to work (where the "gem" is intended for utilization) and I get this error suddenly. There have been no changes.
Here's my code of note:
Sub Formatting()
'
' Formatting Macro
' Macro recorded 9/17/2003 by Jill Honcoop
'
'
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line - Column"
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.Axes(xlCategory).Select
With Selection.TickLabels
.Alignment = xlCenter
.Offset = 100
.ReadingOrder = xlContext
.Orientation = xlUpward
End With
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.ColorIndex = 3
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = xlAutomatic <----This is where it errors!
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 7
.Shadow = False
End With
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 57
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Shadow = True
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 23
.Pattern = xlSolid
End With
ActiveChart.ChartArea.Select
End Sub
Sub Updating()
ActiveSheet.PivotTables(1).RefreshTable
End Sub
Any help or hints as to how to defeat this issue is appreciated. And no laughing at my code! I've only been doing VBA for 2 days....
I have nothing but utter respect for you all that know the answers to these questions. I am a complete newbit at VBA and pivot tables and the like so please bear with me until I am appropriate indoctrinated.
My Question:
I have a series of pivot tables that pull from a singular data source that is currently located w/in the same workbook. Each table has it's own tab and for the most part the charts associated w/ them are very simple and canned w/ no fancy formatting. However, later on I have PT's that chart using the Line-Column Chart and are Macro'd to reformat to a more eye pleasing appearance. This all works like a charm until I change the data series within the PT that I wish to peruse. I get an error and a request to debug. I can click to the next tab and back to that tab and my macros kick in and reformat/refresh the data beautifully with not problem. It is only on selection of a different series of data in one table that it goes nutz.
Also to note, I initially wrote this gem at home w/ Excel 2002 where it worked great not matter what button I poked. I sent it to work (where the "gem" is intended for utilization) and I get this error suddenly. There have been no changes.
Here's my code of note:
Sub Formatting()
'
' Formatting Macro
' Macro recorded 9/17/2003 by Jill Honcoop
'
'
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line - Column"
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.Axes(xlCategory).Select
With Selection.TickLabels
.Alignment = xlCenter
.Offset = 100
.ReadingOrder = xlContext
.Orientation = xlUpward
End With
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.ColorIndex = 3
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = xlAutomatic <----This is where it errors!
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 7
.Shadow = False
End With
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 57
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Shadow = True
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 23
.Pattern = xlSolid
End With
ActiveChart.ChartArea.Select
End Sub
Sub Updating()
ActiveSheet.PivotTables(1).RefreshTable
End Sub
Any help or hints as to how to defeat this issue is appreciated. And no laughing at my code! I've only been doing VBA for 2 days....