0
我总是收到类型不匹配错误或除以零错误,尝试执行以下操作:我只想计算一个范围内唯一条目的数量,范围内的条目是“类“文本:范围内唯一条目的数量,VBA
startRow = 3
startColumn = 1
col = "A"
Set topCell = Cells(startRow, startColumn)
Set bottomCell = Cells(Rows.Count, startColumn)
If IsEmpty(bottomCell) Then Set bottomCell = bottomCell.End(xlUp)
Set selectRows = Range(col & topCell.Row & ":" & col & bottomCell.Row)
nRows = WorksheetFunction.CountA(selectRows)
test = WorksheetFunction.SumProduct(WorksheetFunction.IsText(selectRows)/WorksheetFunction.CountIf(selectRows, selectRows))
我有一个测试计算错误,但我不明白。一些帮助非常赞赏
非常感谢
BR 马丁
虽然'IsText'将在一个工作表函数'Range'对象,我不认为它会接受一个'Range'在VBA中?我一直在玩弄它,并且无法获得VBA中工作表函数的相同行为 – psubsee2003