Results 1 to 8 of 8

VBA code for summiation in MS Excel

Threaded View

  1. #1
    Registered User
    Join Date
    01-03-2011
    Location
    Bangalore, India
    MS-Off Ver
    MS Excel 2010
    Posts
    49

    VBA code for summiation in MS Excel

    Hello There,

    I am wiritng a macro and got struck badly.
    I have a data from Cell C4 to Dxxx (column D is given as xxx because each day the number of rows get changed).
    In column E, i have given the below code

    Sub Test()
    Dim ws As Worksheet
        Dim lRow As Long
        Set ws = ThisWorkbook.Sheets("Sheet1")
        With ws
            lRow = .Range("D" & .Rows.Count).End(xlUp).Row
            .Range("E4:E" & lRow).Formula = "=If(D4>=0,0,D4)"
            .Range("E4:E" & lRow).Value = .Range("E4:E" & lRow).Value
            End With
    End Sub
    Now I am trying to give a Formula in column F but getting struck here...
    If Cell E4<>0,Sum($E$3:E4)
    when it's comes to Cell E5 and if E5<>0,sum($E$3:E5)

    This forumla should be there in all cells which has values in Column E

    As said, the number of rows differs each time.

    Any assistance is highly appreciated!!!

    Thanks!
    Last edited by Srikanth H N; 03-02-2014 at 08:30 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  2. Adding Text to another cell VB code (Help Tweeking code) (Excel 2007)
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2012, 11:37 AM
  3. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  4. Importing Excel Macros Code from another Excel sheet which has Macro code.
    By arun.pillai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2010, 05:38 PM
  5. stubborn Excel crash when editing code with code, one solution
    By Brian Murphy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2005, 02:06 AM

Tags for this Thread

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