Как подсчитать количество пустых ячеек в указанном диапазоне
Категория: Basic
2012-12-30 22:21:04
code: #vba
Public Function CountEmpty&( _ iDiapazon As Range, Optional iAnalog As Boolean) If Not iAnalog Then CountEmpty = _ iDiapazon.Count - Application.CountA(iDiapazon) Else Dim iArea As Range For Each iArea In iDiapazon.Areas CountEmpty = _ CountEmpty + Application.CountBlank(iArea) Next End If End Function
code: #vba
Private Sub Test() 'CountEmpty MsgBox CountEmpty([A1:C3,C6:G8]) '[...], False MsgBox CountEmpty(Range("A1:C3,C6:G8")) MsgBox CountEmpty(Union([A1:C3], [C6:G8])) 'CountBlank MsgBox CountEmpty([A1:C3,C6:G8], True) End Sub
Поделиться: