+ Reply to Thread
Results 1 to 11 of 11

automatically adding up data from large table

  1. #1
    Registered User
    Join Date
    12-13-2005
    Posts
    7

    automatically adding up data from large table

    Hello,

    I have a small problem, and I think that there is an easy solution, but I can't find anything.

    I have data in excel like this:

    ---A B C
    1- 1 3 5
    2- 2 3 6
    3- 4 7 8
    4- 6 6 3
    5- 8 7 9
    6- 9 2 8
    7-
    8- 34 78 56
    9- 45 56 82
    10- 67 68 97
    11- 54 35 75
    12- 56 25 91

    (and the list goes on, with more numbers to both the bottom and the right), and what I want is to add-up the values of each column B and C for A1:6 and A8:12...

    The 'blocks' are of different lenghts down, but of equal length to the right, and are always separated with an empty cell down, like in the example.
    Is there someone who can help?
    I hope I'm clear...

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: automatically adding up data from large table

    How's this?

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    12-13-2005
    Posts
    7

    Re: automatically adding up data from large table

    Domski, thank you so much, you are a genius!! Been thinking about a solution for this for a while, but this is incredibly helpful from you!
    If I ever meet you in a pub, I'll buy you a pint (or two)...

    I'll now try to understand what the macro does, so I can use it in the future.

    Thanks again,

    Arjen

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: automatically adding up data from large table

    No worries, I'll be in The Fleece in Farsley tonight

    If you want me to add some comments to the code as to what it's doing let me know.

    For info this doesn't do anything useful and can be removed:

    Please Login or Register  to view this content.

    I just popped it in so I could see what was happening while I tested it.

    Dom

  5. #5
    Registered User
    Join Date
    12-13-2005
    Posts
    7

    Re: automatically adding up data from large table

    Quote Originally Posted by Domski View Post
    No worries, I'll be in The Fleece in Farsley tonight

    If you want me to add some comments to the code as to what it's doing let me know.

    For info this doesn't do anything useful and can be removed:

    Please Login or Register  to view this content.

    I just popped it in so I could see what was happening while I tested it.

    Dom
    Unfortunately I'm stuck in the former DDR (which normally isn't much fun, but if Germany loses in footy... )....

    Anyway, I'll try to figure the macro out over the weekend, still need to get stuff done now.

  6. #6
    Registered User
    Join Date
    12-13-2005
    Posts
    7

    Re: automatically adding up data from large table

    Quote Originally Posted by Domski View Post
    No worries, I'll be in The Fleece in Farsley tonight

    If you want me to add some comments to the code as to what it's doing let me know.

    For info this doesn't do anything useful and can be removed:

    Please Login or Register  to view this content.

    I just popped it in so I could see what was happening while I tested it.

    Dom
    I have a very stupid question - how can I expand the range of columns? Now the script does the job for columns B and C, but I'd like to include up to column AV or something - is this possible? I've tried to make the ranges a bit wider (from B1:B to B1:AV for example), but that all just spits out bollocks...

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: automatically adding up data from large table

    England are about to kick off and am going to be ruined for the next couple of days but when I get round to it I'll rewrite the code to handle that.

    Come on England!

  8. #8
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: automatically adding up data from large table

    Well that was a bit of an anticlimax, ho hum.

    Anyway, this should deal with however many columns you have in your data:

    Please Login or Register  to view this content.

    Dom

  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: automatically adding up data from large table

    or:

    Please Login or Register  to view this content.

  10. #10
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: automatically adding up data from large table

    snb,

    See what you're doing there but I get an error 424, object required with the code.

    Dom

  11. #11
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: automatically adding up data from large table

    I've corrected it...

    Please Login or Register  to view this content.

    I hadn't thought about using areas

    Dom

+ 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