Hi,
I need to select a range and call it rng, say a1, e1, g1, and i1 then in vba sum this using the worksheetfunction,sum(rng). However it is only pickihn up the first cell. My code and i'm struggling to correct it.
Thanks in advance
Blunder
I need to select a range and call it rng, say a1, e1, g1, and i1 then in vba sum this using the worksheetfunction,sum(rng). However it is only pickihn up the first cell. My code and i'm struggling to correct it.
Thanks in advance
Blunder
Code:
Sub sumcells()
Dim r As Integer
Dim rng As Range
r = ActiveCell.Row
rng = Range("a" & r & "," & "e" & r & "," & "g" & r & "," & "i" & r)
ActiveCell.Value = WorksheetFunction.Sum(rng)
End Sub