使用具有由变量定义的范围的countif

时间:2015-12-28 20:19:54

标签: vba excel-vba countif excel

我正在尝试使用.Countifs语句。我想指望我的代码中的变量定义的列的值。我想这样做:

LastRow = 'defined as last row in file
Dim fcur As Range
Set fcur = Sheet.Cells.Find("sport")
With Application.WorksheetFunction
    baseballs = .CountIfs(Sheet.Range(Cells(1,fcur.Column), (LastRow,fcur.Column)), "=baseball")
End With

我不断收到错误代码,告诉我“对象工作表的方法范围失败了”。我很难过。

0 个答案:

没有答案