我有以下不会为我竞争的代码。当我调试时,它会突出显示下面的一行。
If .Cells(iRow, iCol) = "Yes" Then
然而,相同的代码在我的同事的电脑上工作正常。任何想法为什么会这样? 它提供运行时错误' 32809'应用程序定义或对象定义的错误
Sub Generate_Report()
Dim iRow As Long, iCol As Integer
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
With ThisWorkbook.Sheets("Control")
For iRow = 10 To 18
For iCol = 3 To 4
If .Cells(iRow, iCol) = "Yes" Then
'build workbook
Select Case iCol
Case 3
Application.StatusBar = "Generating... " & .Cells(iRow, 2) & " CM"
Setup_Base_WB iRow, False
Case 4
Application.StatusBar = "Generating... " & .Cells(iRow, 2) & " YTD"
Setup_Base_WB iRow, True
End Select
End If
Next iCol
Next iRow
End With
Application.StatusBar = False
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
MsgBox "Property Reports have been generated.", vbOKOnly + vbInformation, "Reports Generated"
End Sub