Counting Loops
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 *** |
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 *** |
All times are GMT +1. The time now is 12:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com