標題:
請問 Find Address[已解決&謝謝kimbal版大]
[打印本頁]
作者:
HSIEN6001
時間:
2012-7-16 12:00
標題:
請問 Find Address[已解決&謝謝kimbal版大]
本帖最後由 HSIEN6001 於 2012-7-16 13:59 編輯
在A列標出,找到D:F範圍內相應值的位址
請版大幫我看看該修訂的部份
謝謝!
[attach]11695[/attach]
作者:
kimbal
時間:
2012-7-16 13:32
試試
Sub EX()
Dim I As Long, B As Long
Dim myArr As Variant
Dim rng As Range
Application.ScreenUpdating = False
myArr = Array("紐約", "蘋果", "林書豪", "迪潘布洛克", "尼克隊", "驚訝", "球迷")
B = 0
With Sheets("Sheet1").Range("D:F")
For I = LBound(myArr) To UBound(myArr)
Set rng = .Find(What:=myArr(I), _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
B = B + 1
Cells(B, 1).Value = rng.Address
End If
Next I
End With
Application.ScreenUpdating = True
End Sub
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)