2016-11-18 68 views

回答

0

如果你想测试一列(比如列一个),看看它是否只包含空单元格和空值,在工作表中,你可以使用:

=SUMPRODUCT(--(LEN(A:A)>0)) 

,并确保公式返回。在VBA中:

Sub KolumnTest() 
    Dim n As Long 
    n = Evaluate("SUMPRODUCT(--(LEN(A:A)>0))") 
    If n = 0 Then 
     MsgBox "Column A contains only empties and nulls" 
    Else 
     MsgBox "Column A is not empty and should not be deleted" 
    End If 
End Sub 
相关问题