+ Reply to Thread
Results 1 to 4 of 4

create sum formulas with code

  1. #1
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    create sum formulas with code

    Hello. How do I create sum formulas in column D only in the first blank rows above which there is data in the cells. So, D1:D5 has data, D6 is blank, sum D1:D5 in D6, and so on. Thanks.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    It depends on structure data, easier with an attached sample workbook …

    A way :

    PHP Code: 
    Sub Demo()
               
    Dim Rf As RangeRt As Range
               Set Rf 
    Sheet1.Cells(4)
               
    Set Rt Rf.End(xlDown)
        
    Rt(2).Formula "=SUM(" Range(RfRt).Address ")"
               
    Set Rf Nothing
               Set Rt 
    Nothing
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: create sum formulas with code

    This code has an error. Spreadsheet attached.I want to sum blank rows above which there is data.
    Attached Files Attached Files

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: create sum formulas with code

    Hi ammartino44,
    try this
    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. VBA code to create new year and copy down formulas
    By KTW6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2014, 07:08 AM
  2. Using Cell references in file paths for formulas to create dynamic formulas
    By MichaelStokesJr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-04-2013, 11:49 AM
  3. [SOLVED] Help me fix attached code (create Outlook email then create calendar item)
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-19-2013, 08:15 PM
  4. why how does this code create a new sheet after the last line of code...
    By tconnell1965 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2013, 06:23 AM
  5. VBA code to create formulas referencing cells in another workbook
    By new.vbacoder in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2010, 05:11 PM
  6. code to add formulas to a range with previous formulas appearing inside the new one
    By Excel-o-ratoR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2010, 06:02 AM
  7. [SOLVED] How to create a form to insert a hyerlink.VBA code to create a for
    By karthi in forum Excel General
    Replies: 0
    Last Post: 07-05-2006, 06:30 AM
  8. Create a newworksheet with VBA code and put VBA code in the new worksheet module
    By ceshelman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2005, 12:05 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