+ Reply to Thread
Results 1 to 9 of 9

Code to add up range when data range changes

  1. #1
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Code to add up range when data range changes

    Hi,

    I've attached a sample of some data that is generated by code. I need code for a simple sum formula to be included in the cells I've highlight red. The problem is the length of each grouping of data will vary every time the macro is run.

    Thanks for your help.
    Brad
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,569

    Re: Code to add up range when data range changes

    For the data provided.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Code to add up range when data range changes

    Thanks for the quick reply, but sorry your code did not really work. It did put formulas in but they didn't add the columns below red highlighted cells.
    I've tried to amend but was not able to.
    Last edited by BJ5352; 09-14-2016 at 01:45 AM.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,569

    Re: Code to add up range when data range changes

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Code to add up range when data range changes

    Am I missing something? I don't see any red cells.

  6. #6
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Code to add up range when data range changes

    The red cells are in the attached file in the header row above each grouping of data.

  7. #7
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Code to add up range when data range changes

    Thanks for this fix, just about there.

    They are now adding up the correct columns and the first and second formula add the values below them. But the third and forth group of formulas add the values above them not below.

    Are you able to fix this portion of the code?

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,569

    Re: Code to add up range when data range changes

    Just looked at your file again.
    Is this how you wanted?
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-13-2010
    Location
    Barossa SA, Australia
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Code to add up range when data range changes

    Perfect well done jindon

    Just what I was after.
    Last edited by BJ5352; 09-15-2016 at 03:45 AM.

+ 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. Replies: 9
    Last Post: 05-19-2016, 06:48 PM
  2. Replies: 0
    Last Post: 05-18-2016, 04:52 PM
  3. VBA Code to grab data give critiria in textbox and output data range to cell range. Help!?
    By exclusiveicon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2014, 05:31 PM
  4. Code look through range of cells, find blanks & delete cell range in the same row,
    By EagleInsight in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-10-2014, 11:24 AM
  5. Replies: 3
    Last Post: 03-26-2013, 06:06 PM
  6. Problem using loop for sending excel range in email body using Range to HTML code
    By drajanm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2012, 03:17 AM
  7. Code to select range and open a user form is opening the wrong range
    By rrbest in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2010, 12:34 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