View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
gocush[_28_] gocush[_28_] is offline
external usenet poster
 
Posts: 42
Default VBA WorksheetFunction problem

Jeff
you need to add the word : range

Application.WorksheetFunction.CountA(range("B1:B4" ))

"Jeff Wright" wrote:

Greetings!

Can anyone tell me why I get a runtime error (1004) when running the simple
routine below? The data from B1 to B4 is 1, 2, 3, 4. The remainder of the
column is empty.

Sub cmdCountRows_Click()
Dim Leap As Integer
Leap = Application.WorksheetFunction.CountA("B1:B4")
MsgBox Leap
End Sub

Thanks for your help!

Jeff