Hi all
I am trying to union two ranges containing numbers which i then want to sum. In the ranges which start from F7 there will always be a gap to the next range, it will start from F9 or F10 or F11 and so on and so forth. But the answer to my sum formula always gives me the value from F7 rather than the sum of all cells in the entire union. Anyone know what i am doing wrong? Thanks for the help in advance.
Sub union_it()
Dim rng1, rng2, therng As Range
Set rng1 = Sheet1.Cells.Range("F7")
Set rng2 = Sheet1.Cells.Range("F9:F13")
Set therng = Application.Union(rng1, rng2)
Application.Sum (therng)
MsgBox therng
End Sub
I am trying to union two ranges containing numbers which i then want to sum. In the ranges which start from F7 there will always be a gap to the next range, it will start from F9 or F10 or F11 and so on and so forth. But the answer to my sum formula always gives me the value from F7 rather than the sum of all cells in the entire union. Anyone know what i am doing wrong? Thanks for the help in advance.
Sub union_it()
Dim rng1, rng2, therng As Range
Set rng1 = Sheet1.Cells.Range("F7")
Set rng2 = Sheet1.Cells.Range("F9:F13")
Set therng = Application.Union(rng1, rng2)
Application.Sum (therng)
MsgBox therng
End Sub