0
此代碼的工作,直到輸入* ** * ** * ***我試圖在同一時間做兩個不同的搜索之間的編碼。有人能解釋我做錯了什麼嗎?謝謝VBA FindNext中問題
Public Sub Swap()
With Sheet1.Range("A:A")
Set LastCell = .Cells(.Cells.Count)
End With
Set FoundCell = Sheet1.Range("A:A").Find(what:=cusip, after:=LastCell)
If Not FoundCell Is Nothing Then
FirstAddr = FoundCell.Address
End If
Do Until FoundCell Is Nothing
account = Sheet1.Cells(FoundCell.Row, 2)
''#*************************************
Set FoundCell2 = Sheet2.Range("B:B").Find(what:=account)
If Not FoundCell2 Is Nothing Then
FirstAddr2 = FoundCell2.Address
End If
''#*********************************************
Set FoundCell = Sheet1.Range("A:A").FindNext(after:=FoundCell)
''#Break out of loop when searched through all of the cusips
If FoundCell.Address = FirstAddr Then
Exit Do
End If
Loop
End Sub
什麼是你看到的不受歡迎的行爲? – BenV 2010-09-28 00:42:36