我遇到了“运行时错误'1004':应用程序定义或对象定义错误。我的if then语句无法识别正在比较的对象之一,请帮助我了解我做错了什么。
Sub Enter_deposits()
Sheets("Deposits").Activate
Dim x As Integer
Dim y As Integer
For x = 4 To 21
For y = 10 To 500
If Sheets("deposits").Range(2, 4).Value = Sheets((Cells(x, 14).Value)).Range(y, 2).Value _
And Sheets((Cells(x, 14).Value)).Range(y - 1, 3) = 0 _
And Sheets("deposits").Range(x, 15).Value <> Sheets((Cells(x, 14).Value)).Range(y, 3) Then
Sheets("deposits").Range(x, 15).Copy
Sheets((Cells(x, 14).Value)).Range(y, 3).PasteSpecial xlPasteValues
Else
End If
Next y
Next x
End Sub