Summing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to set a column equal to the sum of some other
columns in a macro. It is not working. Can you help.
This is what I have.

Range("A" & m).Value = SUM("V" & m: "V" & (n-1))

Thank you
 
Two options:
Range("A" & m).formula = SUM("V" & m: "V" & (n-1)) 'puts the formula
into the cell Am
Range("A" & m).Value = worksheetfunction.SUM("V" & m: "V" & (n-1))
'puts the result of the sum into cell Am
 
Range("A" & m).Value = WorksheetFunction.SUM(Range("V" & m & ":V" & (n-1))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
It doesn't work. It doesn't like the colon. Thanks.
Any other thoughts?
 
Yep, it wouldn't. Do like Bob says and move the colon inside the quote
for the second V.
 
JWolf said:
Two options:
Range("A" & m).formula = SUM("V" & m: "V" & (n-1)) 'puts the formula
into the cell Am

I think that you mean

Range("A" & m).formula = "=SUM(V" & m & ":V" & (n-1) & ")"
Range("A" & m).Value = worksheetfunction.SUM("V" & m: "V" & (n-1))
'puts the result of the sum into cell Am

Range("A" & m).Value = worksheetfunction.SUM("V" & m & ":V" & (n-1))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top