Counta

billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Evening all

Unsure why the following is resulting in an incorrect value.



Cells(1,7).value = application.WorksheetFunction.CountA(Range("B:B")
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
What result is it giving you....and what result would you expect?

And you're missing a closing parenthesis at the end.
 
Upvote 0
It is returning the value 1 when in fact there are 20 records in the column.

The closing parenthesis it seems wad cut off.

Thank you
 
Upvote 0
Ok, I hate to add another non-answer, but what result do you get if you use the CountA function on the actual worksheet?

The code you posted is right and should return 20 (if you say there's 20)...certainly not 1.
 
Upvote 0
Is it possible to share your workbook on dropbox? Someone could take a look at the whole picture/situation and see what's going on.
 
Upvote 0
Just thought of something else too, and I'm glad you got it working, but if something similar would happen again, make sure your calculation is set to auto vs. manual.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top