Shehroz Malik
Shehroz Malik

Reputation: 43

How to Sum a Range that I Offset?

I have some code that populates data on the next empty column. I do this by using the (x1ToEnd) feature.

However, I am trying to do the same feature with a sum of a range of multiple cells (the ones I want to sum) within my WorksheetFunction.SUM function but the whole range is not working, only the very first cell populates.

Check out my code

range("b8").End(xlToRight).Offset(0, 1).Value = 
WorksheetFunction.Sum(Range("A4:A7").End(xlToRight).Value)

Upvotes: 0

Views: 962

Answers (1)

SJR
SJR

Reputation: 23081

Not sure I follow what you're doing. Does this help?

Range("b8").End(xlToRight).Offset(0, 1).Value = _
                             WorksheetFunction.Sum(Range("A4").End(xlToRight).Resize(4))

Upvotes: 2

Related Questions