Thread: Counting Loops
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 380
Default Counting Loops

Do Until ActiveCell.Value = ""

nTotal = nTotal + 1
If cell.Value < 0 Then
nFirst = nFirst + 1
ActiveCell.Cut ActiveCell.Offset(0, 56)
ActiveCell.Offset(0, 1).Activate
Else
ActiveCell.Offset(0, 1).Activate
End If

Loop

Msgbox "Total: " & nTotal & vbnewline & _
"First: " & nFirst

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Dan G." wrote in message
...

Hello.

I'd like to count how many times particular parts of a loop peform. (At
least I think that's what I want.)

So I have:

Do Until ActiveCell.Value = ""

If ActiveCell.Value < 0 Then
ActiveCell.Cut ActiveCell.Offset(0, 56)
ActiveCell.Offset(0, 1).Activate
Else
ActiveCell.Offset(0, 1).Activate
End If

Loop

and I'd like to know how many times the first instructions are
performed, and how many times the second part of the statement is
performed.

Hope that makes sense. Thanks.

Dan



*** Sent via Developersdex http://www.developersdex.com ***