以下代码产生Object does not support this property or method
错误:
With CellsTab
NumOfProdCells = .Range(.Cells(.Match(CurrentStartRow,.Range("MIRCellColumn"), 0), 4),
.Cells(.Match(CurrentStartRow,.Range("MIRCellColumn"), 0), 4).End(xlDown)).Rows.Count
End With
CellsTab
是一个工作表,NumOfProdCell
的类型为long,CurrentStartRow
也是一个整数,MIRCellColumn
是工作表CellsTab
中的命名范围}。
答案 0 :(得分:3)
由于.match
而失败。
.match
是一个工作簿函数,但您正在使用它,就像它是工作表的方法一样。而是使用:
With CellsTab
NumOfProdCells = _
.Range(.Cells(Application.WorksheetFunction.Match(CurrentStartRow, _
.Range("MIRCellColumn"), 0), 4), _
.Cells(Application.WorksheetFunction.Match(CurrentStartRow, _
.Range("MIRCellColumn"), 0), 4).End(xlDown)).Rows.Count
End With