我有以下行接收"对象不支持属性或方法错误,但我没有看到任何问题。
Dim compliance As Worksheet
Dim report As Worksheet
Dim completeList As Worksheet
Sub getcompliance()
Dim i As Long
Dim n As Long
Dim Source As String
Set compliance = ActiveWorkbook.Worksheets("Compliance")
Set report = ActiveWorkbook.Worksheets("Report")
For i = 3 To report.UsedRange.Rows.Count
For n = 2 To compliance.UsedRange.Rows.Count
report(i, 19) = Application.WorksheetFunction.VLookup(report("i, 3"), compliance("A1:AC2400"), 29, False)
Next n
Next i
End Sub
答案 0 :(得分:3)
你的话说
report(i, 19) = Application.WorksheetFunction.VLookup(report("i, 3"), compliance("A1:AC2400"), 29, False)
应该说
report.Cells(i, 19) = Application.WorksheetFunction.VLookup(report.Cells(i, 3), compliance.Range("A1:AC2400"), 29, False)
但是,如果是这样,你为什么要在For n
循环中这样做?
也许你的意思是你的代码:
Dim compliance As Worksheet
Dim report As Worksheet
Dim completeList As Worksheet
Sub getcompliance()
Dim i As Long
Set compliance = ActiveWorkbook.Worksheets("Compliance")
Set report = ActiveWorkbook.Worksheets("Report")
For i = 3 To report.UsedRange.Rows.Count
report.Cells(i, 19) = Application.WorksheetFunction.VLookup(report.Cells(i, 3), compliance.Range("A1:AC" & compliance.UsedRange.Rows.Count), 29, False)
'Or, simply using the full columns:
'report.Cells(i, 19) = Application.WorksheetFunction.VLookup(report.Cells(i, 3), compliance.Range("A:AC"), 29, False)
Next i
End Sub
答案 1 :(得分:2)
context.startService(new Intent(context, MiServicio.class));