Thread: NFL spreadsheet
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default NFL spreadsheet

It happens that GS forgot to reset the temp counter...

Function GetMostWinnersRow() As Long
Dim n&, k&, i&, j& 'As Long
Dim sWinners As String
sWinners = InputBox("Enter the winning teams")
For i = 1 To 207
For j = 2 To 17
'Count number of cells with winners
If InStr(sWinners, Cells(i, j).Value) 0 Then k = k + 1
Next 'j
'Compare 'k' to current highest count (n) & store 'k' if greater
'and get the row number to return
If k n Then n = k: GetMostWinnersRow = i

k = 0 'reset for next row
Next 'i
End Function 'GetMostWinnersRow()


--
Garry

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