VBA - Summing data in columns

A

ajliaks

Hi,

How can I get the sum of data contained in column "B", from
row 3 to last active row?

Thanks in advance
 
Y

yogendra joshi

If this helps.....

1. Method 1 : Directly summing the entire range

Sub test()
Dim sum_b
sum_b = Application.WorksheetFunction.sum(Range("B3:B65536"))
MsgBox sum_b
End Sub

2. Method 2: Defining the range first (From B3 to the last cell in
column b) and then summing the same

Sub test1()
Dim sum_b
Dim rng As Range
Set rng = Range("B3", Range("B65536").End(xlUp))
sum_b = Application.WorksheetFunction.sum(rng)
MsgBox sum_b
End Sub
 
Top