Home > Net >  Ask god to help put the following code into the corresponding function of c # code.
Ask god to help put the following code into the corresponding function of c # code.

Time:05-28

For help on the Internet, a great god asked him to realize how to function, function description:
In the table 1. Criteria is the province of scoring criteria, if any change you just need to change in the table,
2. The students achievements recorded in the table are sports after the test, the students achievements recorded in the table,
3. The students score (automatic computing) table is calculated automatically according to student achievement and scoring criteria related to student achievement, student information and result entry in the table student information,
The following code (VBA code), please help to translate this code into the same function of c # code, if there is a better code implementation, that would be much thanks,

 Sub test () 
I is Dim r % %
Dim arr, BRR
Dim RNG As Range
Dim d As Object
The Set d=CreateObject (" scripting. The dictionary ")
The Set d1=CreateObject (" scripting. The dictionary ")
With Worksheets (" criteria ")
D1 (" male ")=. Range (" b8: ap38 ")
D1 (" female ")=. Range (" b48: ap78 ")
End With
With Worksheets (" achievements recorded ")
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
Arr=. Range (" a7: as "& amp; R)
End With
ReDim BRR (1 To UBound (arr), 1 To UBound (arr, 2) + 1)
For I=1 To UBound (arr)
For j=1 To 5
BRR (I, j)=arr (I, j)
Next
Next
For I=1 To UBound (arr)
If Len (arr (I, 9)) & lt;> 0 Then
CRR=d1 (arr (I, 5))
For k=1 To UBound (CRR)
If arr (I, 9) & lt;=CRR (k, and 5) Then
BRR (I, 9)=CRR (k, 1)
The Exit For
End the If
Next
If k & gt; UBound (CRR) Then
BRR (I, 9)=0
End the If
End the If
Next
With Worksheets (" students score (automatic) ")
. UsedRange. Offset (6, 0). The Clear
The Columns (3). NumberFormatLocal="@"
Range (" a7 "). The Resize (UBound (BRR), UBound (BRR, 2))=BRR
End With
End Sub
  •  Tags:  
  • C #
  • Related