+ Reply to Thread
Results 1 to 4 of 4

Writing Macro to Sum different Ranges in WorkSheet

  1. #1
    Registered User
    Join Date
    02-09-2009
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2002
    Posts
    2

    Writing Macro to Sum different Ranges in WorkSheet

    Hello,

    I am trying to write a Macro that will sum a range of numbers and then go down to the next range of numbers, hten go to the bottom of that range to where I wnat the Sum and then total the second range.

    I have tried recording the Macro using keystrokes but it keeps putting the Row,Col range in the Macro.

    Here is what I have so far.


    Please Login or Register  to view this content.
    Not all the ranges have the same number of rows in them.

    any help is greatly appreciated.

    Regards

    tattoo

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Writing Macro to Sum different Ranges in WorkSheet

    Hello tattoo,

    Welcome to the Forum!

    Can you give an example of the ranges you will be using. The length of a range can be determined in code using VBA. The macro recorder only records what you type. It isn't designed to optimize the code.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-01-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Writing Macro to Sum different Ranges in WorkSheet

    how are the ranges distinguished? i.e. are there row headers for them?

  4. #4
    Registered User
    Join Date
    02-09-2009
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2002
    Posts
    2

    Re: Writing Macro to Sum different Ranges in WorkSheet

    Quote Originally Posted by mr.alexander View Post
    how are the ranges distinguished? i.e. are there row headers for them?
    Here is an example of my Worksheet

    Please Login or Register  to view this content.

    Sorry I couldn't get it to line up properly but I think it is undestandable.

    The First row does contain a header of each cell. Also as you will notice,
    the first group has 4 records to sum and the second has 13.

    This data is generated from our Invoice System via a Crystal Report and then Exported to Excell Data Only format. the totals that come over now are only displaying the number, not the formula.

    Once the user has Exported this data from our system as shown above,
    she may then have other rows to manually enter on the sheet. If she does then those values are not incorporated into the total values because they are not a formula, only the Total value that is printed by the Crystal report.

    Hope all this makes sense, please let me know if you need more info....


    regards

    tattoo

+ 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