Pivot Table /macro/Formatting Owies :: MrExcel Message Board


 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

Pivot Table /macro/Formatting Owies
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

Nynn
Welcome to the Board


Joined: 20 Sep 2003
Posts: 1

Flag: Usa

Status: Offline

 Reply with quote  

Pivot Table /macro/Formatting Owies

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.... icon_eek.gif

Post Sat Sep 20, 2003 2:41 am 
 View user's profile Send private message

Iridium
Board Master
Board Master


Joined: 16 Jul 2002
Posts: 2581
Location: Walsall, England
Flag: England

Status: Offline

 Reply with quote  

Re: Pivot Table /macro/Formatting Owies

Guessing here but does xlColorIndexAutomatic work any better than xlAutomatic?
_________________

Post Sat Sep 20, 2003 8:12 am 
 View user's profile Send private message
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.