|
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
jgl.Text = 1
l = [IV2].End(xlToLeft).Column
p = [a65536].End(xlUp).Row
For j = 3 To l
If Cells(2, j) = "总分" Then
ksl = j
Exit For
End If
Next j
If ksl <> 0 Then kms.Text = (ksl - 3)
If ksl = 0 Then kms.Text = (l - 7) / 2
For i = 1 To l
If Cells(2, i) = "班级" Then
k1 = i
ComboBox1.Value = GetColName(k1)
Exit For
Else
ComboBox1.Value = ""
End If
Next i
bjhs.Text = 2
ComboBox2.Value = GetColName(3)
jgl.Text = 0
On Error Resume Next
If l > 0 Then
ComboBox1.Clear
ComboBox2.Clear
For i = 1 To l
ComboBox1.AddItem GetColName(i)
ComboBox2.AddItem GetColName(i)
Next i
End If
For k = 3 To p
Cells(k, l - 1) = Application.WorksheetFunction.Sum(Range(Cells(k, 3), Cells(k, l - 2)))
Next k
For k = 3 To p
Cells(k, l) = Application.WorksheetFunction.Rank(Cells(k, l - 1), Range(Cells(3, l - 1), Cells(p, l - 1)))
Next k
Application.ScreenUpdating = True
End Sub |
|