2016-11-18 69 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 
相關問題