我的代码有问题。出现一个错误,我无法摆脱,也不知道它出现的原因。我希望这是像我这样的新手的愚蠢错误,并且您能够轻松发现它。我希望如此。
错误是:
“运行时错误'1004':应用程序定义或对象定义错误”
这是代码:
Sub CGT()
Dim Worksheet As Worksheets
startrow = Worksheets("GUTS").Cells(10, 1) 'Here I put 1
endrow = Worksheets("GUTS").Cells(11, 1) 'Here I put 1000
For x = endrow To startrow Step -1
If Cells(x, "Q").Value = "Sale" Then
If Cells(x, "D").Value = "1" Then
For i = startrow To endrow
If Cells(x - i, "R").Value = "1" Then
Range("G" & x).FormulaR1C1 = "=R[-i]C/R[-i]C[-1]*RC[-1]" 'Debugger highlights this line as bugged.. :(
End If
Next
End If
End If
Next
End Sub
提前谢谢大家,
最好的问候,
阿图尔。