运行以下代码时出现对象定义错误。请帮我调试代码。
For i = 5 To 11
Cells(i, G).Value = Application.WorksheetFunction.CountIf(Workbooks(1).Sheets(1).Range("H:H"), Cells(i, F).Value) + Application.WorksheetFunction.CountIf(Workbooks(1).Sheets(2).Range("H:H"), Cells(i, F).Value)
Next i