none
To find an empty cell and save the summation result in that cell RRS feed

  • Question

  • Want to sum up column C and put the result in the empty cell in column C using VB script. If I use the below code then I can do it:

    Set oRange = oSheet.Range("C2:C6")
    oSheet.Range("C7") = oExcel.WorksheetFunction.Sum(oRange)

    Header1

    Header2

    Header3

    Archive

    5

    94848629

    Archive 2

    10

    195704

    Spend and Save

    3

    1230653

    Workspace

    0

    2

    Workspace1

    677

    247328861

    But I need to take care of  the following conditions which I can't achieve:

    1. Rows may be of unknown numbers. Thus dynamically need to find the last empty cell in column C and then sum up the nonempty cells (excluding Headers) in column c and save the result in the empty cell.

    2. if there is any "0" values in column D ("Header 2") then need to delete that row.


    Crynet

    Wednesday, August 26, 2015 5:09 AM

All replies