Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
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 ***



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting and loops narutard[_5_] Excel Programming 17 July 20th 05 03:55 PM
loops ... jer Excel Programming 4 April 15th 05 04:17 PM
Do loops within Do loops Linking to specific cells in pivot table Excel Programming 4 April 14th 05 08:47 AM
Do Loops Sue[_5_] Excel Programming 1 May 20th 04 07:51 PM
LOOPS Fernando Duran Excel Programming 2 September 3rd 03 01:07 AM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"