+ Reply to Thread
Results 1 to 5 of 5

Format pie-chart in VBA

  1. #1
    Registered User
    Join Date
    03-16-2010
    Location
    Brasil
    MS-Off Ver
    Excel 2003
    Posts
    7

    Format pie-chart in VBA

    Hi all,

    My doubt is probably simple for most of you, but I'm pretty new at this so, better to ask you than keep looking through google.

    I've edited a code in word to create a pie chart and format it according the name of the colors using the select case. When this code is run in a excel 2007 it runs pretty good, but once I write the same code in a excel 2003, it gives me a runtime error which say: "Object variable or With block variable not set". below in the code I show where this message appears.

    My problem is right in this section, how do I solve this issue in excel 2003, once in excel 2007 is working properly.

    Thanks in advance

    The code is:
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    03-12-2009
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 365
    Posts
    236

    Re: Help with a pie-chart format in a VBA code

    try just getting rid of the .select in your with statement
    If you can't figure out how a formula works, try stepping through it using "Evaluate Formula" in the Formula Auditing menu item in the tools menu!

    If you want to see where your code went wrong, try stepping through it by clicking in the code and pressing F8 and watch as the magic happens!


    If you are happy with any of the results, please add to the contributor's reputation by clicking the star icon.

  3. #3
    Registered User
    Join Date
    03-16-2010
    Location
    Brasil
    MS-Off Ver
    Excel 2003
    Posts
    7

    Thumbs down Help with a pie-chart format in a VBA code

    Actually, I thought taking the .select out would solved the issue, because that's what I did in my excel 2007 file. Although in this 2003 file, it happens the same run time error 91.

    Any other idea?
    Last edited by Leosado; 03-19-2010 at 08:14 AM.

  4. #4
    Registered User
    Join Date
    11-19-2013
    Location
    delhi
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Format pie-chart in VBA

    use .application before the WorksheetFunction.Index(.XValues, iPoint)

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

    Re: Format pie-chart in VBA

    This change ran in xl2003 for me

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ 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