Jump to content

(solved) Help with cells ...


Recommended Posts

ukupnok0("9")

Func ukupnok0($count)
    For $i = 7 To $count
        $cell = _ExcelReadCell ($oExcel, "D" & $i, "D")
        _ExcelWriteCell ($oExcel, $cell, "D5")
        If $i > 7 Then
            $prvo = _ExcelReadCell ($oExcel, "D5", "D")
            $ukupno = $prvo + $cell
            _ExcelWriteCell ($oExcel, $ukupno, "D5")
        EndIf
    Next
EndFunc

It doesn't work...For ex.

On D7 is "20" (w/o quotes). On D8 is "30" and on D9 is "40", so it should write 90 (20+30+40) to D5. It writes 80 ! It's never correct...I am obviously doing something wrong. Please help =)

EDIT : Fixed it already...

Func ukupnok0($count)
    For $i = 7 To $count
        If $i = 7 Then
        $cell = _ExcelReadCell ($oExcel, "D" & $i, "D")
        _ExcelWriteCell ($oExcel, $cell, "D5")
        EndIf
        If $i > 7 Then
            $cell = _ExcelReadCell ($oExcel, "D" & $i, "D")
            $prvo = _ExcelReadCell ($oExcel, "D5", "D")
            $ukupno = $prvo + $cell
            _ExcelWriteCell ($oExcel, $ukupno, "D5")
        EndIf
    Next
EndFunc
Edited by mafioso
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...