View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Looking For A Formula

Here's the result of running the code on the sample data you posted...

x 0 0 0 0 2 3 0 '//1st 0
0 0 0 0 0 0 1 '//ignored
--
0 0 0 0 0 0 0 '//ignored
x 0 0 1 0 0 1 0 '//1st 0
--
x 0 0 0 0 0 0 1 '//1st 0
0 0 0 0 0 0 0 '//ignored
--
x 0 3 0 3 1 0 0 '//1st 0
0 2 0 1 0 0 0 '//ignored
--
0 0 0 0 0 0 0 '//ignored
x 1 0 0 3 3 0 0 '//1st 0
--
x 0 0 1 1 1 0 0 '//1st 0
0 0 0 0 0 0 0 '//ignored
----'//test set
0 0 0 0 0 0 0 '//ignored
0 0 0 0 0 0 0 '//ignored

...as rendered by this code...

Sub DenoteCellsGreaterThanZero2()
Dim r As Long
Dim b1 As Boolean, b2 As Boolean
For r = 1 To ActiveSheet.UsedRange.Rows.Count Step 2
With Application.WorksheetFunction
b1 = (.CountIf(Rows(r), "0") 0)
b2 = (.CountIf(Rows(r).Offset(1), "0") 0)
End With 'Application.WorksheetFunction
If b1 Then Cells(r, 1) = "x": GoTo nextset
If b2 Then Cells(r, 1).Offset(1) = "x"
nextset:
Next 'r
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc