J
John Pierce
Public Sub Evaluate ()
Dim R As Single
Dim C As Integer
Range("i11").Select
For R = 11 To 15
For C = 9 To 108 '100 Columns
Cells(R, C).Value = _
Evaluate("=SUMPRODUCT(COUNTIF(" & Chr(C + 64) & "$2: _
" & Chr(C + 64) & "$7,$C" & R & ":$H" & R & "))")
Next C
Next R
End Sub
The procedure above gives correct results only out to Col Z.
After that, things get weird. I know it it because of the letter
column reference but I don't know how to fix it. The function
below is supposed to help but I don't know how to use it.
Private Function strColid(jColNo As Long) As String
' returns column name/id of colno
strWhere = "strColid"
'
If jColNo > 0 And jColNo <= 256 Then
If jColNo < 27 Then
strColid = Chr$(((jColNo - 1) Mod 26) + 65)
Else
strColid = Chr$(64 + Int((jColNo - 1) / 26)) &
Chr$(((jColNo - 1) Mod 26) + 65)
End If
Else
strColid = "#N/A"
End If
End Function
Dim R As Single
Dim C As Integer
Range("i11").Select
For R = 11 To 15
For C = 9 To 108 '100 Columns
Cells(R, C).Value = _
Evaluate("=SUMPRODUCT(COUNTIF(" & Chr(C + 64) & "$2: _
" & Chr(C + 64) & "$7,$C" & R & ":$H" & R & "))")
Next C
Next R
End Sub
The procedure above gives correct results only out to Col Z.
After that, things get weird. I know it it because of the letter
column reference but I don't know how to fix it. The function
below is supposed to help but I don't know how to use it.
Private Function strColid(jColNo As Long) As String
' returns column name/id of colno
strWhere = "strColid"
'
If jColNo > 0 And jColNo <= 256 Then
If jColNo < 27 Then
strColid = Chr$(((jColNo - 1) Mod 26) + 65)
Else
strColid = Chr$(64 + Int((jColNo - 1) / 26)) &
Chr$(((jColNo - 1) Mod 26) + 65)
End If
Else
strColid = "#N/A"
End If
End Function