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
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
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
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
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)))
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3
[Turnus!AM1]=[sum(Turnus!BR1:CS1)]
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
msgbox [sum(Turnus!BR1:CS150)]