I have a range that i have set as myrng
this range is A1:a100, in this range i have either a "n" or a "y" in
each cell, how can i use code to count all the y's within this range
john
I have a range that i have set as myrng
this range is A1:a100, in this range i have either a "n" or a "y" in
each cell, how can i use code to count all the y's within this range
john
Hello John,
you can make a for each loop und test if the value is y or n.
For each vItem in myrng
if vItem = "y" then count = count +1
next vItem
is there a way of doing it without looping i have seen a previous post
which used
count=countwords(myrng,"y"), but this does not seem to work
regards
John
count = Application.COUNTIF(myrange,"y")
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
<[email protected]> wrote in message
news:[email protected]...
> is there a way of doing it without looping i have seen a previous post
> which used
> count=countwords(myrng,"y"), but this does not seem to work
>
> regards
>
> John
>
or
Sub countem()
x = Application.CountIf(Range("a1:a100"), "y")
MsgBox x
End Sub
--
Don Guillett
SalesAid Software
[email protected]
<[email protected]> wrote in message
news:[email protected]...
>I have a range that i have set as myrng
> this range is A1:a100, in this range i have either a "n" or a "y" in
> each cell, how can i use code to count all the y's within this range
>
> john
>
thanks that great!!!
John
glad to help
--
Don Guillett
SalesAid Software
[email protected]
<[email protected]> wrote in message
news:[email protected]...
> thanks that great!!!
>
> John
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks