View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default What's the vba code equivalent for Countif

Hi,

Simply tell the VB compiler it's a worksheetfunction

Onlap = WorksheetFunction.CountIf(Worksheets("A Grade").Range("I5:I104"), L)

Mike

"NDBC" wrote:

I tried using the foloowing code

Onlap = CountIf(Worksheets("A Grade").Range("I5:I104"), L)

and it says that countif is an undefined sub or function. What is the
correct VB code in 2003 to count the number of times a number occurs in a
range.

Thanks