|
- Public n
- Private Sub Worksheet_Change(ByVal Target As Range)
- If n = 0 Then
- n = 1
- Dim i, k, r
- Set r = Target.Cells(1, 1)
- If r.Row > 1 And r.Column = 1 Then
- If r = "" Then
- r.Offset(0, 1) = ""
- Else
- For i = 2 To 7
- If r = Cells(i, 4) Then k = i
- Next
- If k > 0 Then
- r.Offset(0, 1) = Cells(k, 5)
- Else
- r.Offset(0, 1) = "未找到!"
- End If
- End If
- ElseIf r.Row > 1 And r.Column = 2 Then
- If r = "" Then
- r.Offset(0, -1) = ""
- Else
- For i = 2 To 7
- If r = Cells(i, 5) Then k = i
- Next
- If k > 0 Then
- r.Offset(0, -1) = Cells(k, 4)
- Else
- r.Offset(0, -1) = "未找到!"
- End If
- End If
- End If
- n = 0
- End If
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|