Debugging 宏VBA脚本

Debugging 宏VBA脚本,debugging,excel,visual-c++,vba,Debugging,Excel,Visual C++,Vba,有人能帮我解决这个问题吗。我有这个代码,但它不工作。有点不对劲,它说子函数或函数没有定义 Sub Macro1() ' ' Macro1 Macro ' Dim x As Integer, result As String x = 2 ' 1st row Do While Cells(x, 4).Value = 1 If Cells(x, 3).Value <= Cells(x, 2).Value And Not Cells(x, 4).Value < Cells

有人能帮我解决这个问题吗。我有这个代码,但它不工作。有点不对劲,它说子函数或函数没有定义

Sub Macro1()
'
' Macro1 Macro
'
Dim x As Integer, result As String

x = 2

' 1st row

Do While Cells(x, 4).Value = 1

      If Cells(x, 3).Value <= Cells(x, 2).Value And Not Cells(x, 4).Value < Cells(x, 1).Value Then
      result = "pass"

      Else
      result = "fail"

      End If
      Cell(x, 5).Value = result

      x = x + 1
Loop

End Sub
一个单元格换一个单元格,它就会工作。Excel对于那个错误消息的帮助还不够。但是,当您打开编辑器并尝试运行它时,它会为单元格选择文本

Sub Macro1()
'
' Macro1 Macro
'
Dim x As Integer, result As String

x = 2

' 1st row

Do While Cells(x, 4).Value = 1

      If Cells(x, 3).Value <= Cells(x, 2).Value And Not Cells(x, 4).Value < Cells(x, 1).Value Then
      result = "pass"

      Else
      result = "fail"

      End If

      Cells(x, 5).Value = result

      x = x + 1
Loop

End Sub