Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try WorksheetFunction.CountIf
-- Gary "John" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 Gary Keramidas wrote: try WorksheetFunction.CountIf |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Gary "John" wrote in message ... 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 Gary Keramidas wrote: try WorksheetFunction.CountIf |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I Already do that... I was trying to find a neater way.
John Gary Keramidas wrote: 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Countif works that same as it does in a worksheet. In a worksheet it would
not work with a discontiguous range either. -- Regards, Tom Ogilvy "John" wrote: 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 Gary Keramidas wrote: try WorksheetFunction.CountIf |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rats. So for non-contiguous you are back to for-next loop searches loops
instead of built in functions. John Tom Ogilvy wrote: Countif works that same as it does in a worksheet. In a worksheet it would not work with a discontiguous range either. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using dcount function within user-defined worksheet function | Excel Programming | |||
Excel - User Defined Function Error: This function takes no argume | Excel Programming | |||
Need to open the Function Arguments window from VBA for a user defined function. | Excel Programming | |||
COUNTIF 2 Conditions using Defined Names | Excel Worksheet Functions | |||
User-Defined Function pre-empting Built-in Function? How to undo???? | Excel Programming |