寫了一個簡單的代碼, 不是很精簡, 將就用吧

來源: 真源湛寂 2006-10-10 12:36:52 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (1130 bytes)
回答: 用宏, 或者自定義的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

請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”