• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Add count formula in Macro

dingdang

Member
Hi,


Required help to add formula in macro to count data from B2 till last row of column B as data is not fixed.

have tried to record macro but its recording cell , pls guide.


code :


Range("A100000").End(xlUp).Offset(1, 0).Select

ActiveCell.FormulaR1C1 = "39"

Range("B100000").End(xlUp).Offset(1, 0).Select

ActiveCell.FormulaR1C1 = "=COUNT(R[-28]C:R[-1]C)"
 
Hi, dingdang!


Try this:

ActiveCell.Formula = "COUNT(B2:B" & Range("B100000").End(xlUp).Row & ")"


Regards!
 
Hi, dingdang!

Glad you solved it. Thanks for your feedback and for your kind words too. And welcome back whenever needed or wanted.

Regards!
 
Back
Top