VBA Excel: Code for summing a column function

Solved
Anne -  
 Chaden -
Hello,

I am working on Excel 2010 and I am looking for a VBA code that would simply allow me to sum the data in a column regardless of the number of rows.
Specifically, in column A I have the labels of the rows, and in B the associated numerical data, which I would like to sum in B2 (B1 being the label of column B).

I thank the VBA programming specialists in advance for their valuable help!!

Anne

1 réponse

michel_m Posted messages 18903 Registration date   Status Contributeur Last intervention   3 320
 
Hello
Option Explicit
Sub zzzzz()
Dim Fin As Long, Liste As Range
Fin = Columns("B").Find("*", , , , , xlPrevious).Row
Set Liste = Range("B3:B" & Fin)
Range("B2") = Application.Sum(Liste)
End Sub


--
Michel
4
Anne
 
Hello Michel,

Thank you for your response, which works perfectly!
Do you know how to apply the same formula to a table that could have several columns?

Thanks again!
0
Chaden
 
thank you very much michelle
0