Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count
Hello,
I would like to make my macro perform an operation every 25th and 10th time it passes through a Do Loop and/or a For Next Loop. I am familiar with setting the variable to 0 before the loop then + 1 everytime through, but how can I have it do something else every 10th time through. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count
One way:
Dim i As Long For i = 0 to 100 If (i = 10) or (i = 25) Then 'Do special stuff End If 'Do normal stuff Next i In article , wrote: Hello, I would like to make my macro perform an operation every 25th and 10th time it passes through a Do Loop and/or a For Next Loop. I am familiar with setting the variable to 0 before the loop then + 1 everytime through, but how can I have it do something else every 10th time through. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count
Thanks,
but what about the next 10 or 25, when the count gets to 20 and 30 and 40 or 50 and 75 and 100 Thanks -----Original Message----- One way: Dim i As Long For i = 0 to 100 If (i = 10) or (i = 25) Then 'Do special stuff End If 'Do normal stuff Next i In article , wrote: Hello, I would like to make my macro perform an operation every 25th and 10th time it passes through a Do Loop and/or a For Next Loop. I am familiar with setting the variable to 0 before the loop then + 1 everytime through, but how can I have it do something else every 10th time through. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count
I didn't interpret your requirements that way. Here's one way:
Dim i As Long For i = 1 to 100 If (i Mod 10 = 0) or (i Mod 25 = 0) Then 'Do special stuff End If 'Do normal stuff Next i In article , wrote: but what about the next 10 or 25, when the count gets to 20 and 30 and 40 or 50 and 75 and 100 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count
Thank You
-----Original Message----- I didn't interpret your requirements that way. Here's one way: Dim i As Long For i = 1 to 100 If (i Mod 10 = 0) or (i Mod 25 = 0) Then 'Do special stuff End If 'Do normal stuff Next i In article , wrote: but what about the next 10 or 25, when the count gets to 20 and 30 and 40 or 50 and 75 and 100 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count Employee Work Time - Don't Count Duplicates | Excel Worksheet Functions | |||
Count Employee Work Time - Don't Double-count Overlapping Apts. | Excel Worksheet Functions | |||
Excel 2000, count, sort a list & count totals? | Excel Worksheet Functions | |||
How do i count numbers and letters to find a total count of all | Excel Worksheet Functions | |||
Count Intervals of Filtered TEXT values in Column and Return Count across a Row | Excel Worksheet Functions |