+ Reply to Thread
Results 1 to 31 of 31

Macro that will sum up a sheet

  1. #1
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Macro that will sum up a sheet

    I am needing to create a macro that will sum up a sheet based on number that only start with 30, 39, 40, 48, & 35. This sheet will need to reflect the entire row that falls within those numbers. The column with those numbers is "C".Sample File.xlsxAttached is a sample of the Data I am working with. Any help is appreciated!

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Will it be for Columns H, I and J? Do you want a total for each number or a total for all?

  3. #3
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Just for I is what I am wanting to sum up, but for each warehouse. (EX LB has 5000, LC has 7500...)

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    How did you come up with 5000 for LB? What I have to offer is returning $75,0361.00 for Column I.

  5. #5
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    The 5000 was just an example, not a realistic number in this sheet. Sorry for the confusion. I return the 750,360lbs for all the numbers that fall in the criteria.

  6. #6
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    What I am trying to accomplish on this sheet it to get the amount (Lbs) in each Warehouse for each part number.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    How many warehouses will you have. This is what I used to come up with that number? Also where would you want the results too go?

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    There are approximately 71 warehouses. I will run it. If they could be created on a new sheet on the workbook that would be fine. Thanks for you help!

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Can you provide a list of warehouses?

  10. #10
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    That worked for getting the total of all. Attached is the modified workbook. The macro I am wanting will take everything other than the part numbers I am wanting. Then I can sort in a pivot table, unless a macro can do that as well...Sample File.xlsx

  11. #11
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    here is the list of WH'sList of WH's.xlsx

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Try:

    Please Login or Register  to view this content.
    Note: Added a Sheet called warehouses and a Sheet called totals -
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Thanks John! Would there be a way instead of deleting the rows, to just move the needed data to the Formatted tab?

  14. #14
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    I started to copy the Raw Data sheet to the Formatted Tab and then run the macro off of that. Would that be of use? Anyway I'll have to revisit in morning, I'm out for today.

  15. #15
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Ok, thanks John! Its not big deal if not. I tried plugging in the macro on my actual sheet and it is still running. It has around 40,000 lines on it. Its been running for about 8 minuets now. Maybe there would be a quicker way to go about this? Not sure, but thanks for all your help! Have a great evening!

  16. #16
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Quote Originally Posted by mort.marshall.20 View Post
    Thanks John! Would there be a way instead of deleting the rows, to just move the needed data to the Formatted tab?
    Try:

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Thanks John! Getting an "Expected End Sub" & "For control Variable already in use" error when trying to run.

  18. #18
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Also is the Warehouse and Total page needed to perform this?

  19. #19
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Add End Sub at the very bottom. I think I missed it when I copied and posted it.

  20. #20
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Actually I missed a couple of lines. Try.

    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Thanks John! That works great! It runs it very quickly but now it is bogging down once it is complete. Any way to fix that?

  22. #22
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Quote Originally Posted by mort.marshall.20 View Post
    Also is the Warehouse and Total page needed to perform this?
    The warehouse total count was requested. You don't need pages but the lists of warehouses need to be stored somewhere, and the resultant count needs to be placed somewhere.

  23. #23
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Quote Originally Posted by mort.marshall.20 View Post
    Thanks John! That works great! It runs it very quickly but now it is bogging down once it is complete. Any way to fix that?
    What do you mean bogging down once it is complete?

  24. #24
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Well after its complete, switching from tab to tab takes forever, but if I save it and reopen it I have no issue's until I run the macro again.

  25. #25
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Quote Originally Posted by mort.marshall.20 View Post
    Well after its complete, switching from tab to tab takes forever, but if I save it and reopen it I have no issue's until I run the macro again.
    Do you mean manually activating Tabs is slow? What happens if you just save it?

  26. #26
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Yes, manually clicking on the tabs. After I saved it nothing changed, but after I close and re open there are no issue's. Also sorry to ask, but can you change the code back to where there is no formatted page? I am sorry to keep changing it, 1 of these days I will get this figured out...haha

  27. #27
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    You mean you want the rows deleted instead?

  28. #28
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Yes, sorry. I will not need the other data, just the info that falls into that criteria. Thanks!

  29. #29
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Does the code in Post #12 work then?

  30. #30
    Registered User
    Join Date
    11-12-2013
    Location
    Winslow, Arkansas
    MS-Off Ver
    Excel 2016
    Posts
    62

    Re: Macro that will sum up a sheet

    Yes, but it is really slow, takes 24 minuets to run.

  31. #31
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that will sum up a sheet

    Is this any better?

    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] Macro to copy data from a master sheet to separate sheet as per date using a macro
    By tmaster81 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2014, 08:05 AM
  2. Macro to gnereate new sheet which includes the macro to generate a new sheet
    By jocanon in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-27-2013, 05:15 PM
  3. [SOLVED] Macro running on active sheet instead of sheet defined in macro
    By davegscott in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 02:04 PM
  4. [SOLVED] Macro to Copy Data from one Sheet A to Sheet B based on value in cell on sheet A
    By scass in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 07:21 PM
  5. Replies: 1
    Last Post: 07-30-2012, 02:35 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