我正在處理一個宏,這個宏可以幫助我將Excel中的數據從一個工作表複製到另一個工作表中。我試着下面的代碼,但我得到了一個需要對象錯誤我該如何解決一個對象所需的錯誤
任何幫助表示讚賞
Sub copier()
Dim ws1 As Worksheet, ws2 As Worksheet, src As Range, dest As Range, i As Integer
Set ws1 = Worksheets("Workload - Charge de travail")
Set ws2 = Worksheets("Sheet1")
For i = 2 To ws1.Range("A1").SpecialCells(xlLastCell).Row
Set src = ws1.Range("A" & i & ":AL" & i + 50)
Set dest = ws2.Range("A" & i & ":AL" & i + 50)
If Source.Cells(i, 31).Value = "Completed - Appointment made/Complété - Nomination faite" Then
'(i,31) this is for my drop down list's condition
src.Copy Destination:=dest
dest.Value = dest.Value
End If
Next i
End Sub
什麼是「源」?它應該是'src'嗎? –
發生什麼錯誤? – transistor1