我不能使这段代码工作,这是一个"类型不匹配错误"

Tho*_*y S 1 excel vba excel-vba

这段代码有什么问题吗?我需要查看一列,如果该值小于参考值(它是一个计时器),则需要复制相邻单元格并输入"A8".

谢谢.

Sub GetData()

Dim i As Integer

For i = 4 To 31

If Cells(i, 38) < Cells(32, 5) Then
Cells(1, 8) = Cells(i, 39)
End If

Next i

End Sub
Run Code Online (Sandbox Code Playgroud)

Kaz*_*wor 6

或者替代所有呈现的选项添加此额外的If statement现有之前if:

 If IsError(Cells(i, 39)) = False And IsError(Cells(32, 5))= False Then
Run Code Online (Sandbox Code Playgroud)