View Single Post
  #27   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

Ron,
Given the logic you detailed in your email, the bottom line is that
ColA will contain an x based on the FINAL CHECK of the last column in
each set. That precludes, then, than some sets will have x in both rows
(which you clearly stated is NOT what you want). In this case, both
macros need only be done on the last column to return the desired
results. Thus, your sample file is NOT correct as sent because it
places x in the 1st row of every set (as you stated). Using your logic
as stated (checking every cell in both rows) will result in an x being
on every row of every set because at some point checking every cell, an
x is always placed in ColA for both rows BECAUSE your logic doesn't say
to remove an x in the other row of the set being checked.

If the last column determines the result in ColA for both rows of a set
then there should only be 5 x's on your sample wks: Rows
11,14,17,20,26.

Here's the code I used...

Sub PlaceX2()
Dim vTemp As Variant, lRow As Long, lCol As Long
Dim bRow1 As Boolean, bRow2 As Boolean
lCol = Cells.Find(What:="*", _
After:=Cells(Rows.Count, Columns.Count), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Column
Columns(1).ClearContents
For lRow = 1 To Cells(Rows.Count, 2).End(xlUp).Row Step 2
vTemp = Range(Cells(lRow, 2), Cells(lRow + 1, lCol))
bRow1 = (vTemp(1, lCol - 1) 0)
bRow2 = (vTemp(2, lCol - 1) 0)
If bRow1 Then Cells(lRow, 1) = "x": GoTo nextset
If bRow2 Then Cells(lRow, 1).Offset(1) = "x"
nextset:
Next 'lRow
End Sub

--
Garry

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