3
所以,我有一個工作表,其中我想在範圍(「A:A」)中搜索Range的值(「M」& i)。然而,當我嘗試運行這段代碼,它返回一個錯誤:「運行時錯誤‘91’:對象變量或帶塊未設置當我點擊調試,它對象變量或塊未設置 -
SearchIn = Range("A:A")
我發現了一個錯誤。爲什麼Google在互聯網和這個網站(找到了),但我還是解決不了問題。任何人都得到了線索?
Sub Find_Replace()
Dim i As Integer
Dim SearchIn As Range
Dim SearchedObject As Range
Dim FinalCell As Range
Dim SumCell As Range
i = 5
SearchIn = Range("A1:A740")
StartSearch = Range("A" & i)
FinalCell = Range("N" & i)
Do While i <= 740
SearchedObject = SearchIn.Find(What:="M" & i, After:=StartSearch, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If SearchedObject.Value = Range("M" & i).Value Then FinalCell = FinalCell.Value + SearchedObject.Offset(0, 5).Value
Loop
End Sub
非常感謝你......解決了它。 :) – speci