VBA Count Function

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

hey guys

I have a range of data in column P. I know the Excel
count function but in this case, I need to use the count
function in VBA. I looked in help and could not find it.
Because the range of data can vary in the column, the data
will change. How do I use VBA code to count the number of
values in the columnP? After I do this I can store it as
a variable and use it in my code.


Thank you

Todd Huttenstine
 
Todd,

You can call worksheet function in VBA with the
Application.WorksheetFunction class. E.g.,

Dim Res As Long
Res = Application.WorksheetFunction.Count(Range("P1:P100"))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thank you.
-----Original Message-----
Todd,

You can call worksheet function in VBA with the
Application.WorksheetFunction class. E.g.,

Dim Res As Long
Res = Application.WorksheetFunction.Count(Range ("P1:P100"))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



message news:[email protected]...


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top