+ Reply to Thread
Results 1 to 6 of 6

Noob with the ubiquitous "format pivot chart" question

  1. #1
    Registered User
    Join Date
    08-02-2006
    Posts
    25

    Noob with the ubiquitous "format pivot chart" question

    This question has been posted everywhere and I think I've read through dozens of posts if not a hundred. I too have a multi-axis pivot format that I would like to apply to a pivot chart. I have recorded the following macro:

    Sub Format_axis()
    '
    ' Macro recorded 8/23/2006 by Mr. Magoo
    '

    '
    ActiveChart.SeriesCollection(2).Select
    ActiveChart.SeriesCollection(2).AxisGroup = 2
    ActiveChart.Axes(xlValue, xlSecondary).Select
    Selection.TickLabels.AutoScaleFont = True
    With Selection.TickLabels.Font
    .Name = "Arial"
    .FontStyle = "Regular"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = 3
    .Background = xlAutomatic
    End With
    ActiveChart.SeriesCollection(2).Select
    With Selection.Border
    .ColorIndex = 3
    .Weight = xlThin
    .LineStyle = xlContinuous
    End With
    With Selection
    .MarkerBackgroundColorIndex = 3
    .MarkerForegroundColorIndex = 3
    .MarkerStyle = xlSquare
    .Smooth = False
    .MarkerSize = 5
    .Shadow = False
    End With
    ActiveChart.Axes(xlValue).Select
    Selection.TickLabels.AutoScaleFont = True
    With Selection.TickLabels.Font
    .Name = "Arial"
    .FontStyle = "Regular"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = 5
    .Background = xlAutomatic
    End With
    ActiveChart.SeriesCollection(1).Select
    With Selection.Border
    .ColorIndex = 5
    .Weight = xlThin
    .LineStyle = xlContinuous
    End With
    With Selection
    .MarkerBackgroundColorIndex = 5
    .MarkerForegroundColorIndex = 5
    .MarkerStyle = xlDiamond
    .Smooth = False
    .MarkerSize = 5
    .Shadow = False
    End With
    End Sub
    The problem lies in the fact that I am just now starting to learn VBA but as always, the boss needs this done ASAP. I have external data from an Access database feeding the pivot table and linked pivot chart. I want the chart to run this macro everytime a combo box is changed in value.

    Where do I apply this? The worksheet? The workbook? The chart object? I'm new to VBA code also so an explanation of the major parts of the VBA code would really help a lot. Thanks to anyone who can help me on this...I'll be sure to reciprocate for the next guy asking this question...
    Last edited by ST4RCUTTER; 08-23-2006 at 05:31 PM.

  2. #2
    Registered User
    Join Date
    08-02-2006
    Posts
    25
    Anyone? I'm just looking to apply this macro in the correct way. How do I apply this? To the object, the sheet, the workbook?

  3. #3
    Registered User
    Join Date
    08-02-2006
    Posts
    25
    Help!


  4. #4
    Registered User
    Join Date
    08-29-2006
    Posts
    5
    I haven't a way to test this but if you view the code for the sheet that contains the ComboBox that will be changed and paste the following code there. Then each time there is a selection change in the combo box the code should run. I hope this is the solution to your problem or at least a step in the right direction for you.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-02-2006
    Posts
    25
    Thanks tmiley, you are the first to respond to my question. The combo box is one of many that make up controls on the pivotchart. I don't believe they have names associated to them like in Access, although they might. That said, I would need the macro to run after any combo box is changed. Is there a way to tie a macro to the entire pivot chart or even the sheet? In this way any change to the pivotchart or sheet would fire off the macro to re-format the chart. Thanks!

  6. #6
    Registered User
    Join Date
    08-02-2006
    Posts
    25
    Help! Just need to know how to evoke a macro when any control on a pivot chart is updated/changed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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