PDA

View Full Version : [SOLVED] Counting Used Cells in a Range



Cyberdude
07-03-2005, 01:21 PM
If I write


Msgbox Range("A1:A10").count

I get the number of rows in the range.
How do I write a statement using .Count to get a count of the number of used cells in the range? :banghead:

Jacob Hilderbrand
07-03-2005, 01:30 PM
You need to specify what you want to count, in this case Cells.


Msgbox Range("A1:A10").Cells.Count


Now what do you mean by used cells? Only cells with values or all cells in the range. If you only want cells with certain values you can use SpecialCells to narrow the range.

Cyberdude
07-03-2005, 01:35 PM
You pretty much told me what I was missing. I just want to know how many of the cells in a column have values.
I'll investigate the SpecialCells to see what possibilities it offers. Thanx drj!

Jacob Hilderbrand
07-03-2005, 01:44 PM
You're Welcome :beerchug:

Take Care

sheeeng
07-03-2005, 06:54 PM
You need to specify what you want to count, in this case Cells.


Msgbox Range("A1:A10").Cells.Count


Now what do you mean by used cells? Only cells with values or all cells in the range. If you only want cells with certain values you can use SpecialCells to narrow the range.


.Count
Simple yet I forgot...
I must be getting old...:bawl (http://www.vbaexpress.com/forum/misc.php?do=getsmilies&wysiwyg=1&select_category=Sad+%2F+Depressed#)