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

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 tha

August 26th, 2015 1:16am

Hi JRV,

posted my modified code in 

 https://social.technet.microsoft.com/Forums/en-US/3fe96d54-e589-4373-82cf-26b459a88883/moving-rows-from-one-sheet-to-another-another-in-the-same-workbook?forum=exceldev



August 26th, 2015 8:17am

Hi Crynet,

Have your issue been resolved? Based on your link, it seems that they are the same issue, if so, could you delete this thread, or do you need us to merge these two threads? If they are not the same issue, it would be helpful if you could share more information about this issue, whether you have error message or which function the code did not work.

Best Regards,

Edward

Free Windows Admin Tool Kit Click here and download it now
August 27th, 2015 3:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics