CountIF = function not defined ???

  • Thread starter Thread starter John
  • Start date Start date
J

John

excel vba 6.3 countif gets me a "Function not defined" error. I took the
example straight out of a book. MsgBox = CountIf(Col(1), "*") where
Col(1) is a range array.

I copied some more examples having nothing to do with my program into a
simple macro they all get the same error. Doesn't 6.3 (Excell 2003) have
Countif in it?

John
 
thanks... that did it.

Have another problem now. The countif doesn't work with a range I put
together using "union" I took a chance on that.

----
Dim Rows(9) as Range
Set Rows(n) = Union(Cells(n, 1), Cells(n, 3), Cells(n, 5))
----

I'm trying to have a collection or range or array of evey other cell in
a row that i can work with. Is that possible as a range? I tried to read
about collections but just got screwed up.

thanks

John
 
not exactly sure what you're trying to accomplish, but:

Option Base 1
Sub test()
Dim arr() As String
Dim i As Long, n As Long

For i = 1 To 18
If i Mod 2 = 1 Then
n = n + 1
ReDim Preserve arr(1 To n)
arr(n) = Cells(1, i).Value
End If
Next

End Sub
 
Countif works that same as it does in a worksheet. In a worksheet it would
not work with a discontiguous range either.
 
Rats. So for non-contiguous you are back to for-next loop searches loops
instead of built in functions.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top