+ Reply to Thread
Results 1 to 11 of 11

VBA Code for Adding % Diff Column to Numerous Sheets?

  1. #1
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    VBA Code for Adding % Diff Column to Numerous Sheets?

    Hi,

    I have a huge Excel document with 1000+ sheets. Each sheet has "year" columns (2009, 2010, 2011, and 2012), and varying numbers of rows (anywhere from 1 to about 100), and I'd like to add columns to each sheet showing the year vs. year % difference.

    I've attached a workbook with a before/after example. Any help on this would be greatly appreciated.

    Thanks

    Excel Percent Diff Example.xlsx
    Last edited by kestefon; 02-20-2013 at 04:33 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    Are the % columns already there? Or must they be inserted?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    The columns are already there (I just added an attachment to my original message, by the way). Basically I'll have all of the sheets formatted, and I'll just be adding three % difference columns to each one. I could just select all the sheets and drag the forumula down, but that doesn't work since each sheet has different numbers of rows. Of course, if I were just dealing with a handful of sheets, this wouldn't be a problem, but since I have more than 1000 sheets to format, I need to figure out a simple way of doing this.

  4. #4
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    Are you able to access the attachment?

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    hi kestefon, option, formulas and % format get inserted, run code "test1"
    Attached Files Attached Files

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    In that case - try this:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    Thanks, guys, those work perfectly! I was even able to figure out how to adjust watersev's to do add a % share column.

    Thanks again.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    You're welcome!

  9. #9
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    One more question pertaining to this project: Is there a way to automatically rank all of the sheets in my report? I would basically like to re-sort all of the rows so that the data is high-to-low on the 2012 column.

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    @kestefon

    Please Login or Register  to view this content.

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Code for Adding % Diff Column to Numerous Sheets?

    Hi Kestefon,

    Here's mine:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-21-2013 at 03:30 PM.

+ 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