For c = 4 To ActiveSheet.UsedRange.Columns.Count - 1 Step 2
isUpdate = False
selectedCol = (c - 4) \ 2 + 2 '获取 当前表附表 中对应列号
For j = 2 To Worksheets(FileName).UsedRange.Rows.Count
If ActiveSheet.Cells(r, c).Value <> ""And ActiveSheet.Cells(r, c).Value = Worksheets(FileName).UsedRange.Cells(j, selectedCol).Value Then
ActiveSheet.Cells(r, c + 1).Value = Worksheets(FileName).UsedRange.Cells(j, 1).Value
isUpdate = True
EndIf
Next
'如果没有更新,值为""
IfNot isUpdate Then
ActiveSheet.Cells(r, c + 1).Value = ""
EndIf
Cells(r, c + 1).Select
Next
Next
EndSub
'点击时,获取成绩
PublicSub CellsClick(ByVal Target As Range)
Dim FileName AsString
FileName = GetName() + "附"
'只能选择(5,4)到有效表格的区域,否则跳过
If Target.Column < 4 Or Target.Row < 5 Or Target.Column > ActiveSheet.UsedRange.Columns.Count - 1 Or Target.Row > ActiveSheet.UsedRange.Rows.Count Then