其他分享
首页 > 其他分享> > VBA实例:高考分数投档指数分析(模块3.同步代码部分)

VBA实例:高考分数投档指数分析(模块3.同步代码部分)

作者:互联网

Sub 重点大学同步代码()
 Dim I%
 Dim rng As range, rng1 As range, rng2 As range
     For Each rng In ThisWorkbook.Worksheets("重点大学明细").range("C2", ThisWorkbook.Worksheets("重点大学明细").[C2].End(xlDown))
        For Each rng1 In ThisWorkbook.Worksheets("院校分专业入取线").range("f2", ThisWorkbook.Worksheets("院校分专业入取线").[f2].End(xlDown))
            If rng = rng1 Then
                 rng(1, 0) = rng1(1, 0)
                 Exit For
            End If
       Next rng1
        For Each rng2 In ThisWorkbook.Worksheets("985大学").range("C2", ThisWorkbook.Worksheets("985大学").[C2].End(xlDown))
            If rng = rng2 Then
                 rng(1, 3) = rng2(1, 2)
                 Exit For
            End If
       Next rng2
    Next rng
End Sub
Sub 学校评级同步代码()
 Dim I%
 Dim rng As range, rng1 As range, rng2 As range
     For Each rng In ThisWorkbook.Worksheets("学校评级").range("C2", ThisWorkbook.Worksheets("学校评级").[C2].End(xlDown))
        For Each rng1 In ThisWorkbook.Worksheets("院校分专业入取线").range("f2", ThisWorkbook.Worksheets("院校分专业入取线").[f2].End(xlDown))
            If rng = rng1 Then
                 rng(1, 0) = rng1(1, 0)
                 Exit For
            End If
       Next rng1
    Next rng
End Sub

标签:ThisWorkbook,VBA,End,rng,range,实例,rng1,Worksheets,投档
来源: https://blog.51cto.com/12815848/2527924