PDA

View Full Version : Sum with integer



Borut
11-02-2020, 05:42 AM
Hello,

How can I sum with vba, wih integer, code is
Worksheets("Turnus").Cells(l,39).Value= Application.WorksheetFunction.Sum(Range(Cells(l,60),Cells(l+87)))

this code not working, sum number is wrong

Bob Phillips
11-02-2020, 07:29 AM
Bit light on detail, but maybe this is what you want


With Worksheets("Turnus")
.Cells(l,39).Value= Application.Sum(.Range(.Cells(l,60),.Cells(l,87)))
End With

Paul_Hossler
11-02-2020, 08:13 AM
I'm guessing that you meant Row 1 (not "l") and that you wanted to sum the cells between columns 60 and 87 in row 1 (not l+87)




Worksheets("Turnus").Cells(1,39).Value= Application.WorksheetFunction.Sum(Range(Cells(1,60),Cells(1,87)))

snb
11-02-2020, 09:12 AM
[Turnus!AM1]=[sum(Turnus!BR1:CS1)]

Borut
11-02-2020, 11:38 AM
L is integer, beacuse I have 150 row to sum.
Sum 1 line, and then go to the next line (but sum is the same colums). I wrote a mistake, yes colums 60 to 87

snb
11-02-2020, 12:50 PM
msgbox [sum(Turnus!BR1:CS150)]