Hi Team,

How to make code dynamic to cover last row if data increase?. Thanks in advance !!

Below is my code it is giving Result 12, Instead of 33,


Sub Test_sum()

Dim lr As Long

lr = Range("B100").End(xlUp)

Range("D2") = Application.WorksheetFunction.Sum(Range("b2:B" & lr))

End Sub

A B
Name Count
a 5
b 7
c 10
d 8
e 3


Thanks
Mallesh