VBA(excel) Write an algorithm that solves the problem below. You may use any com
ID: 3667059 • Letter: V
Question
VBA(excel)
Write an algorithm that solves the problem below. You may use any combination of pseudo code or VBA syntax discussed in class. Remember to include the purpose, input, output, and body of the algorithm. Create an algorithm for an Excel worksheet that contains a column of numbers starting at cell ”B1”. The algorithm adds the numbers together starting from cell ”B1” and stops when it encounters a cell with a ”SUM” string. When adding numbers, the algorithm skips cells with numbers less than or equal to zero. After, the algorithm replaces the ”SUM” in the worksheet with the sum of numbers.
Explanation / Answer
SetobjExcel=CreateObject("Excel.Application")
SetobjWorkbook=objExcel.Workbooks.Open_
("D:Users biswasDocumentscheggmatBook1.xlsx")
intCol=2'AsreferedcoloumnisB
cell=1
sum=0
DoUntilobjExcel.Cells(intCol,2).Value="SUM"
sum=sum+objExcel.Cells(intCol,cell).Value
cell=cell+1
Loop
objExcel.Cells(intCol,cell).Value=sum
objExcel.Quit
Hope it helps. Please let me know if you are facing any difficulties.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.