Pivot Table /macro/Formatting Owies

Nynn

New Member
Joined
Sep 19, 2003
Messages
1
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.... :eek:
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Guessing here but does xlColorIndexAutomatic work any better than xlAutomatic?
 
Upvote 0

Forum statistics

Threads
1,215,781
Messages
6,126,870
Members
449,345
Latest member
CharlieDP

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top