View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
yogendra joshi yogendra joshi is offline
external usenet poster
 
Posts: 48
Default VBA - Summing data in columns

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


ajliaks < wrote:

Hi,

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

Thanks in advance.


---
Message posted from http://www.ExcelForum.com/