LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default loop help

I use the following code to build a chart that analyzes data ranges. I want to skip anything that results in a '0' value in the chart but i keep coming up with issues. the code:

For i = keystart + 1 To keyend
Range("n" & i).Value = step1 & "-" & step2
Range("o" & i).Formula = "=COUNTIF(H:H, ""<=" & step2 & " "")-COUNTIF(H:H, ""<" & step1 & """)"
With Range("q" & i)
.Formula = "=p" & i & "/p" & keyend + 1
.NumberFormat = "0.00%"
End With
With Range("p" & i)
.Formula = "=SUMIF(H:H, ""<=" & step2 & " "",I:I )-SUMIF(H:H, ""<" & step1 & """,I:I)"
.Style = "currency"
End With
If Range("p" & i).Value = 0 Then
Range("n" & i & ":q" & i).Value = "" '''' This blanks out the line, which is good
i = i - 1 '''' This makes me re-run the loop on the same row, which is good, but i will never equal keyend,
End If
step1 = step2 + 1
step2 = step2 + 5
Next i

how would i get the loop to continue thru each step without resulting in a never-ending loop?
 
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
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM


All times are GMT +1. The time now is 03:08 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"