+ Reply to Thread
Results 1 to 7 of 7

Need Help Condensing Code

  1. #1
    Registered User
    Join Date
    03-04-2014
    Location
    Irving, Texas
    MS-Off Ver
    Excel 2010
    Posts
    37

    Need Help Condensing Code

    Hi All! So i have code that does exactly what i want but it is too large to run. Would anyone have any suggestions on how i can condense this to allow it to run? When it looks at Target.Address E32 i will have 54 blocks of that "Case 4 Week Rolling...." code so it gets rather large, where the ****** are. The Data is in the form of a calendar with columns being every day of the year so i dont think setting up a pivot table and utilizing slicers will allow for what this code does. It basically removes all the data fields in the pivot table then adds in calculated columns i have worked out after the calendar. Any help or inspiration is appreciated!

    Please Login or Register  to view this content.
    Last edited by bchilme; 01-09-2015 at 02:37 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Need Help Condensing Code

    thanks, code tags inserted
    Last edited by protonLeah; 01-09-2015 at 02:59 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    03-04-2014
    Location
    Irving, Texas
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Need Help Condensing Code

    Sorry about that. Updated.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Need Help Condensing Code

    What exactly is in cell E32? Is it the actual text string: "4 Week Rolling Ending on 01/24/2015"? How does it get changed, manually, week to week? Is there a cell with the current date somewhere in the sheet?
    Last edited by protonLeah; 01-09-2015 at 03:48 PM.

  5. #5
    Registered User
    Join Date
    03-04-2014
    Location
    Irving, Texas
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Need Help Condensing Code

    Correct, it is a Data Validation List. The user selects which week they want to see the data for. So for example in PivotTable 10 WEEK ENDING ON 1/24/15 would be the fourth week of the year. So for the 4 week rolling we would need the data from weeks 1-4. So the code clears the pivot table then puts "Week 1,2,3,4 All Assignments" into the pivot and then puts "Week 1,2,3,4 Days Worked". Then i have a cell outside the pivot that just divides the sum of assignments by the sum of days worked and i graph off of these numbers.

    If you notice for pivot table 11 i calculated the numbers in to helper columns in the data. So rather than adding 8 data fields to the pivot i add only 2. I suppose i could do that for pivot table 10 but its alot of work so just seeing if i can keep this somehow.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Need Help Condensing Code

    The code below uses a loop which starts four weeks prior to the current week. Not tested since no workbook was posted.
    Please Login or Register  to view this content.
    Last edited by protonLeah; 01-09-2015 at 10:04 PM.

  7. #7
    Registered User
    Join Date
    03-04-2014
    Location
    Irving, Texas
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Need Help Condensing Code

    Thanks for the reply it worked perfectly! Did some minor changes but worked awesome. Thanks!

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Condensing VBA Code
    By MHamid in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-30-2013, 03:04 PM
  2. Condensing Find Code
    By Gus80 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2008, 12:20 AM
  3. condensing vba code
    By Zygoid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2007, 08:45 AM
  4. Need help condensing with-end with code
    By excelnut1954 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2006, 10:55 AM
  5. Trouble Condensing Code
    By Ikaabod in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2006, 04:53 PM

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