+ Reply to Thread
Results 1 to 5 of 5

Changing the font of an axis in a pivot chart

Hybrid View

phrankndonna Changing the font of an axis... 06-25-2012, 06:03 PM
Andy Pope Re: Changing the font of an... 06-26-2012, 03:49 AM
phrankndonna Re: Changing the font of an... 06-26-2012, 10:02 AM
Andy Pope Re: Changing the font of an... 06-26-2012, 10:08 AM
phrankndonna Re: Changing the font of an... 06-26-2012, 10:17 AM
  1. #1
    Forum Contributor
    Join Date
    03-23-2012
    Location
    Michigan
    MS-Off Ver
    MS365 Excel version 2301 (Build 16026.20238)
    Posts
    105

    Changing the font of an axis in a pivot chart

    Hi. I recorded a macro to change the font size of my pivot chart, but when I run the macro, it crashes with the error message of object not set. Below are the few lines of code that recorded. What might be wrong? Thanks.

        ActiveChart.ChartArea.Select
        ActiveChart.Axes(xlCategory).Select
        With Selection.Format.TextFrame2.TextRange.Font
            .BaselineOffset = 0
            .Size = 9
        End With
    Frank
    Last edited by Paul; 06-25-2012 at 08:47 PM. Reason: Added CODE tags. Please do so yourself in the future.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Changing the font of an axis in a pivot chart

    try

    ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 9
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    03-23-2012
    Location
    Michigan
    MS-Off Ver
    MS365 Excel version 2301 (Build 16026.20238)
    Posts
    105

    Re: Changing the font of an axis in a pivot chart

    Hi, Unfortunately, I must not have something declared or set correctly, because I'm still getting a 'Object variable or With block variable not set' error message.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Changing the font of an axis in a pivot chart

    As it is a single line then I can only assume you do not have the chart selected when the code is run.

  5. #5
    Forum Contributor
    Join Date
    03-23-2012
    Location
    Michigan
    MS-Off Ver
    MS365 Excel version 2301 (Build 16026.20238)
    Posts
    105

    Re: Changing the font of an axis in a pivot chart

    I got this to work. I just had this line of code in the wrong place. Thank you very much for your help.

+ 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