Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to do the following sum macro but I get an error for the
sum fomula. I want to sum the values from range B2 to B&i, the corresponding value of "i".. Please let me know how do I do this. Thanks Sub test() Dim i As Integer For i = 1 To 100 Range("A1").Value = Sum(Range(B2, B&i)) Next i End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Dim i As Long For i = 1 To 100 Range("A1").Value = application.Sum(Range("b2:B" & i)) Next i End Sub wrote: I am trying to do the following sum macro but I get an error for the sum fomula. I want to sum the values from range B2 to B&i, the corresponding value of "i".. Please let me know how do I do this. Thanks Sub test() Dim i As Integer For i = 1 To 100 Range("A1").Value = Sum(Range(B2, B&i)) Next i End Sub -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Public Sub test() Dim i As Integer For i = 1 To 100 Range("A1").Value = _ Application.WorksheetFunction.Sum("B2:B" & i) Next i End Sub In article .com, wrote: I am trying to do the following sum macro but I get an error for the sum fomula. I want to sum the values from range B2 to B&i, the corresponding value of "i".. Please let me know how do I do this. Thanks Sub test() Dim i As Integer For i = 1 To 100 Range("A1").Value = Sum(Range(B2, B&i)) Next i End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Range("A1").Value = Application.Sum(Range("B2:B & i))
is all you need, no loop -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message oups.com... I am trying to do the following sum macro but I get an error for the sum fomula. I want to sum the values from range B2 to B&i, the corresponding value of "i".. Please let me know how do I do this. Thanks Sub test() Dim i As Integer For i = 1 To 100 Range("A1").Value = Sum(Range(B2, B&i)) Next i End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
After reading Bob's post, I'm not sure what you wanted.
Range("A1").Value = application.Sum(Range("B2:B100")) or maybe something like: Sub test() Dim i As Long For i = 1 To 100 Range("A" & i).Value = application.Sum(Range("b2:B" & i)) Next i End Sub Dave Peterson wrote: Sub test() Dim i As Long For i = 1 To 100 Range("A1").Value = application.Sum(Range("b2:B" & i)) Next i End Sub wrote: I am trying to do the following sum macro but I get an error for the sum fomula. I want to sum the values from range B2 to B&i, the corresponding value of "i".. Please let me know how do I do this. Thanks Sub test() Dim i As Integer For i = 1 To 100 Range("A1").Value = Sum(Range(B2, B&i)) Next i End Sub -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
But which "i" should be used? <g
My impression was that this was just a test... In article , "Bob Phillips" wrote: Range("A1").Value = Application.Sum(Range("B2:B & i)) is all you need, no loop |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'll leave that to the OP's discretion <g^2
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "JE McGimpsey" wrote in message ... But which "i" should be used? <g My impression was that this was just a test... In article , "Bob Phillips" wrote: Range("A1").Value = Application.Sum(Range("B2:B & i)) is all you need, no loop |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Oct 30, 8:57 am, JE McGimpsey wrote:
But which "i" should be used? <g My impression was that this was just a test... In article , "Bob Phillips" wrote: Range("A1").Value = Application.Sum(Range("B2:B & i)) is all you need, no loop- Hide quoted text - - Show quoted text - Thanks guys. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Read ".dll" files, the Macro "work flow" and the actual values of the variables when Macro is running | Excel Programming | |||
"Type mismatch" when I try to fill an Array variable with "+" | Excel Discussion (Misc queries) | |||
Question on determining "ROW" inside of a "For .. RANGE " loop | Excel Programming | |||
Excel macro "loop" | Excel Programming | |||
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" | Excel Programming |