+ Reply to Thread
Results 1 to 13 of 13

sum every 10 rows for all sheets

  1. #1
    Forum Contributor
    Join Date
    10-31-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    221

    sum every 10 rows for all sheets

    Hi can someone help me with a vba macro for all the sheets in the workbook I need to sum column E every 10 rows for example

    sum(E1:E10)
    sum(E11:E20)
    sum(E21:E30)

    Write the answers in column G and H

    so column G and column H
    E1:E10, 14

    There are 900,000 rows on each sheet

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: sum every 10 rows for all sheets

    Hello
    Try this code
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    10-31-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    221

    Re: sum every 10 rows for all sheets

    Hi YasserKhalil thanks for the reply I got a run time error when I ran the code this part was highlighted For i = LBound(a) To UBound(a) Step 10, as soon as I press debug and reset. Then I check the sheets I see the code has worked but I still get the error each time I run
    Last edited by Roadhouse; 03-22-2018 at 07:03 PM.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: sum every 10 rows for all sheets

    Can you provide sample of your workbook ..

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: sum every 10 rows for all sheets

    Gee, at 900,000 rows per sheet you're really pushing Excel to the limit. Seems more like an Access Db solution to me.

    That said try this:

    Please Login or Register  to view this content.
    Will take some time run however.

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  6. #6
    Forum Contributor
    Join Date
    10-31-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    221

    Re: sum every 10 rows for all sheets

    Hi YasserKhalil I put the macro in another workbook and ran it and there was no problems I think it was just a corrupt workbook, thanks for your help

  7. #7
    Forum Contributor
    Join Date
    10-31-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    221

    Re: sum every 10 rows for all sheets

    Hi Trebor76 thanks for the reply your macro worked but only on the first sheet I need it to work on all the sheets.

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: sum every 10 rows for all sheets

    You're welcome. Glad it worked for you

  9. #9
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: sum every 10 rows for all sheets

    and another example, clone with Do ... Loop - for one sheet:
    Please Login or Register  to view this content.
    and for many sheets:
    Please Login or Register  to view this content.
    Last edited by mjr veverka; 03-22-2018 at 07:25 PM.

  10. #10
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: sum every 10 rows for all sheets

    Hi Trebor76 thanks for the reply your macro worked but only on the first sheet I need it to work on all the sheets.
    It did run on every sheet but because I didn't initialise the lngOutputRow variable it put the formula after the last row from Sheet1, then Sheet2...

    Try this slightly modified code:

    Please Login or Register  to view this content.
    Regards,

    Robert

  11. #11
    Forum Contributor
    Join Date
    10-31-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    221

    Re: sum every 10 rows for all sheets

    Hi Trebor76 that change worked the macro runs on all sheets thanks for your help

  12. #12
    Forum Contributor
    Join Date
    10-31-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    221

    Re: sum every 10 rows for all sheets

    Hi porucha vevrku, thanks for the reply your macro worked

  13. #13
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: sum every 10 rows for all sheets

    All macros work, you can put them on the auction ... ... we take 10% only ...

+ 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. Hide Rows in most sheets skipping hidden sheets
    By NancyPez in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-11-2016, 04:53 PM
  2. [SOLVED] Create Sheets and copy rows to the Sheets if cell contains sheet names
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2015, 08:06 AM
  3. [SOLVED] Delete all charts and empty rows from all sheets; won't change sheets
    By astrbac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-29-2015, 10:12 AM
  4. Need help with copying rows, replicating sheets, naming sheets and assigning print area...
    By Navin Agrawal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2014, 09:21 AM
  5. Check value in two sheets and copy nonmatching rows to third sheets
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2014, 10:35 AM
  6. Replies: 1
    Last Post: 02-25-2013, 11:37 AM
  7. Automatically inserting new rows in sheets or updating the sheets
    By AlexOram in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2012, 07:35 AM

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