View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default count the number of nonblank cells within a range

One way:

nCells = Application.CountA(Range("A1","I20"))


In article ,
Hervinder wrote:

i want to be able to count cells within a range that are non blank or have a
value in them.

i am able to count all cells by doing

ncells = range("a1","120").cells.count

is there a similar code that will count the cells which only have a value in
them.

the only way i can think of doing this is either a loop and selecting each
cell within the range or by using the counta function within excel itself.

thank you in advance
Hervinder