當我輸入下面的函數在細胞中的一個UDF:使用VBA計數可見空白單元格?
Function VisibleBlankCells(r As Range) As Long
On Error Resume Next
VisibleBlankCells = Intersect(r.SpecialCells(xlCellTypeVisible), r.SpecialCells(xlCellTypeBlanks)).Count
On Error GoTo 0
End Function
r.SpecialCells(xlCellTypeBlanks)
評估所有細胞r
爲空,不管它們是否含有文本或沒有。這可能是什麼原因和替代解決方案?
你有沒有嘗試刪除你的'在錯誤恢復下一個(不寒而慄)聲明,看看有沒有實際的錯誤? – 2015-02-11 08:59:54