gpt4 book ai didi

vba - 计算行数时出现“对象不支持属性或方法”错误

转载 作者:行者123 更新时间:2023-12-04 21:59:07 25 4
gpt4 key购买 nike

以下代码生成 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 s 是 long 类型, CurrentStartRow也是整数, MIRCellColumn是工作表中的一个命名范围 CellsTab .

最佳答案

失败是因为 .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

关于vba - 计算行数时出现“对象不支持属性或方法”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38491519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com