+ Reply to Thread
Results 1 to 10 of 10

Beautifying Pivot Table Macro Code

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Beautifying Pivot Table Macro Code

    Hi,

    My code works perfectly fine, but I was wondering if there was a way to make it prettier.

    I like clean looking code. This code is pretty bulky


    Please Login or Register  to view this content.
    Last edited by Airgaf; 03-01-2011 at 07:36 PM. Reason: wrong tags

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Beautifying Pivot Table Macro Code

    Hi there,

    It's impossible for me to check the operation of the following code as I don't have access to your workbook or data. All I can say is that the code at least compiles correctly and it looks a bit neater than the original version!

    Take a look at the code and see if it does what you want:

    Please Login or Register  to view this content.

    Hope this is of some use to you - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Beautifying Pivot Table Macro Code

    Airgaf

    Please use Code Tags not Quote Tags
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    02-23-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Beautifying Pivot Table Macro Code

    What are code tags and how do I make them?

  5. #5
    Registered User
    Join Date
    02-23-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Beautifying Pivot Table Macro Code

    Oh, and thank you for your help

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Beautifying Pivot Table Macro Code

    Hi again,

    in your original post you "wrapped" your code in QUOTE tags, i.e.:

    Your Code Here
    Instead of using QUOTE tags (via the "Document-type" icon in the toolbar), use the one beside it (the Hash icon), and your code will look like this:

    Please Login or Register  to view this content.

    By the way, did the code I proposed work correctly for you? As I mentioned, I couldn't check the operation of it myself.

    Regards,

    Greg M

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Beautifying Pivot Table Macro Code

    If you bother to read the Forum Rules you would learn about Code Tags and avoid such issues. There's also a "How To" menu at the top of the Forum

  8. #8
    Registered User
    Join Date
    02-23-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Beautifying Pivot Table Macro Code

    Oh. My bad. I thought I was clicking the code tag this whole time. My mistake

  9. #9
    Registered User
    Join Date
    02-23-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Beautifying Pivot Table Macro Code

    Sorry for not replying sooner Greg, but I just finished a major presentation. Now I have time to tinker with macros. I tried your code and while it was very nice looking, I keep getting a Run-time error '9': Subscript out of range.

    When I debug,

    Please Login or Register  to view this content.
    become highlighted in yellow.

  10. #10
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Beautifying Pivot Table Macro Code

    Hi again,

    In the code line:

    Please Login or Register  to view this content.
    did you remember to change the value from "Sheet2" to the name of the appropriate worksheet in your workbook?
    The error you're seeing is consistent with not having a worksheet named "Sheet2" in your workbook.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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