RE: "Counter" in macro
- From: Mike H <MikeH@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 15 Sep 2008 10:55:02 -0700
Hi,
You don't need a macro this will do it
=COUNTIF(A1:D200,"Boo")
But if you have a particular reson for wanting a macro then use this
Sub marine()
Dim Myrange As Range
Set Myrange = Range("A1:D200")
For Each c In Myrange
If UCase(Trim(c.Value)) = "BOO" Then
Count = Count + 1
End If
Next
MsgBox Count
End Sub
Mike
"bobkap" wrote:
Can anyone help me with this please?.
I want to run a macro that loops through many rows of data and counts each
time a certain condition is met. For example, lets say I have 200 rows of
data that's 4 columns wide. I want to know how many times the word "boo" has
occurred in any of these 800 cells.
Thanks!
- Follow-Ups:
- Re: "Counter" in macro
- From: Rick Rothstein
- Re: "Counter" in macro
- References:
- "Counter" in macro
- From: bobkap
- "Counter" in macro
- Prev by Date: "Counter" in macro
- Next by Date: Re: Refering to Codenames in Remote Workbooks
- Previous by thread: "Counter" in macro
- Next by thread: Re: "Counter" in macro
- Index(es):
Relevant Pages
|
Loading