Sign in to follow this  
Followers 0
mafioso

(solved) Help with cells ...

1 post in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0