|
本帖最后由 zy596561385 于 2017-3-2 10:14 编辑
因为我是初学者,不要笑话我。代码有点长
- Sub 排名()
- Dim a%, b%
- Dim yjs1 As Range
- Dim fds1 As Range
- Dim yjs2 As Range
- Dim fds2 As Range
- Dim yjshR1 As Range
- Dim yjshR2 As Range
- Dim fdshR1 As Range
- Dim fdshR11 As Range
- Dim rng As Range
- Set yjs1 = [b1]
- Set fds1 = [b1]
- Set yjs2 = [b1]
- Set fds2 = [b1]
- zsyhs = Columns(1).Find("*", , , , , xlPrevious).Row
- For Each rng In Range("b2:b" & zsyhs)
- abc = rng.Address
- If rng = "应届生" Then
- Set yjs1 = Union(yjs1, rng)
- Set yjs2 = Union(yjs2, rng)
- Else
- Set fds1 = Union(fds1, rng)
- Set fds2 = Union(fds2, rng)
- End If
- Next
- mc = 1
- For Each yjshR1 In yjs1
- yjshR11 = yjshR1.Address
- a = Range(yjshR11).Row
- If a > 1 Then
- cj1 = Cells(a, 3)
- For Each yjshR2 In yjs2
- yjshR22 = yjshR2.Address
- b = Range(yjshR22).Row
- If b > 1 Then
- cj2 = Cells(b, 3)
- If cj2 > cj1 Then mc = mc + 1
- End If
- Next
- Cells(a, 4) = mc
- mc = 1
- End If
- Next
- Set fdshR11 = [b1]
- For Each fdshR1 In fds1
- fdshR11 = fdshR1.Address
- c = Range(fdshR11).Row
- mc = 1
- If c > 1 Then
- fdscj = Cells(c, 3)
- For Each yjshR1 In yjs1
- yjshR11 = yjshR1.Address
- a = Range(yjshR11).Row
- If a > 1 Then
- cj1 = Cells(a, 3)
- If fdscj = cj1 Then Cells(c, 4) = Cells(a, 4): GoTo 100
- End If
- Next
- For Each yjshR1 In yjs1
- yjshR11 = yjshR1.Address
- a = Range(yjshR11).Row
- If a > 1 Then
- cj1 = Cells(a, 3)
- If fdscj < cj1 Then
- mc = mc + 1
- End If
- End If
- Next
- Cells(c, 4) = mc
- End If
- 100:
- Next
- End Sub
复制代码
|
|