Excel VBA: Adding values of entire row

jefferyy

New member
Local time
Tomorrow, 00:52
Joined
Sep 19, 2013
Messages
1
Hi all. I need to write a coding in VBA to add up total row cells value of the entire row of excel. Example like, I input A1 B1 D1 with values or randomly input B1 to Z1 with values then it will autosum it including those blank cells. One row, sometimes 3 columns with values, sometimes 50 columns with values. What do I write for the coding? Sorry for my poor english. Thanks in advance.
 
Please explain why the Alt + =, then confirm with Enter (this is the AutoSum) won't work?
If a cell has the formula =SUM(B4:X4)
It will sum all the valued cells. Blanks don't affect it.

in code:
Range("A8").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[2]:RC[30])"
 

Users who are viewing this thread

Back
Top Bottom