我正在尝试在sub中使用两个工作表函数,对于WorksheetFunction.PercentRank
,我可以使用relevant_array
,但是当我使用relevant_array
WorksheetFunction.CountIf
时,我一直收到错误1}}。我希望在.CountIf
.PercentRank
中使用相同的数组/范围。
Dim y As Variant
Dim z As Variant
PricePerKG = POCost
Set ws = ActiveWorkbook.Worksheets("Modified Item Extract")
Set relevant_Array = ws.Range(ws.Range("B2"), ws.Range("B2").End(xlDown)).SpecialCells(xlCellTypeVisible)
y = WorksheetFunction.PercentRank(relevant_Array, POCost, 4)
Percentile = Format(y, "0.00%")
z = WorksheetFunction.CountIf(relevant_Array, ">" & POCost)
PriceAbove = z