如何從活動工作表上的單元格中獲取值並在非活動工作表上查找它,然後重命名該值?vba在另一個工作表上查找單元格值並重命名值?
Dim rw As Long
rw = ActiveCell.Row
If Sheets("Home").Range("D" & rw).Value = "Tender" Then
With Worksheets("Time Allocation").Columns("B:B")
Set cell = .Find(What:=.Range("B" & rw).Value, After:=Range("B" & rw), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not cell Is Nothing Then
cell.Value = "test"
Else
cell.Value = "test"
End If
End With
End If
我一直在使用cell.value =「測試」嘗試,但此將導致錯誤: 對象變量或塊與變量未設置
請能有人告訴我在哪裏,我錯了?
你的錯誤在哪裏? –