写了一个简单的代码, 不是很精简, 将就用吧

回答: 用宏, 或者自定义的FUNCTION真源湛寂2006-10-10 10:28:27

我试验过的.




Option Explicit


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim i


If Target.Address = "$A$1" Then
Application.EnableEvents = False
For i = 3 To 200
If Cells(i, 1) = Target.Value Then
Cells(1, 2) = Cells(i, 2)
Application.EnableEvents = True
Exit Sub
End If
Next

For i = 3 To 200
If Cells(i, 3) = Target.Value Then
Cells(1, 2) = Cells(i, 4)
Application.EnableEvents = True
Exit Sub
End If
Next


For i = 3 To 200
If Cells(i, 5) = Target.Value Then
Cells(1, 2) = Cells(i, 6)
Application.EnableEvents = True
Exit Sub
End If
Next

Application.EnableEvents = True
Else
Exit Sub
End If



End Sub

所有跟帖: 

大礼收了,非常感谢! -laohutuchong- 给 laohutuchong 发送悄悄话 (0 bytes) () 10/10/2006 postreply 12:42:31

两个注意事项: -真源湛寂- 给 真源湛寂 发送悄悄话 真源湛寂 的博客首页 (66 bytes) () 10/10/2006 postreply 12:45:39

请您先登陆,再发跟帖!