我有一张工作表,其中有来自两个不同来源的数据。它们之间有一个空白行。我想将此空白行作为分隔符。如何确定整行是否为空白.
最佳答案
如果您说的是整行,那么与此类似的代码应该可以工作(只要任何单元格中不存在公式或空格):
If Application.CountA(ActiveCell.EntireRow)=0 Then
MsgBox "Row Empty"
Exit Sub
End If
否则,对于行中的范围:
Dim neValues As Range, neFormulas As Range, MyRange As Range
Set MyRange = Columns("C:AA")
On Error Resume Next
Set neValues = Intersect(ActiveCell.EntireRow.SpecialCells(xlConstants), MyRange)
Set neFormulas = Intersect(ActiveCell.EntireRow.SpecialCells(xlFormulas), MyRange)
On Error GoTo 0
If neValues Is Nothing And neFormulas Is Nothing Then
MsgBox "Nothing There"
Else
MsgBox "Something's There"
End If
(来源:http://www.ozgrid.com/forum/showthread.php?t=26509&page=1)
关于excel - 如何通过vba找出excel中整行是否为空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3628057/