2010-09-02 29 views

cevap

15

bu çalışması gerekir için (aynı zamanda hücrelerin herhangi birinde mevcut hiçbir formüller veya boşluk vardır sürece) bir hazır tüm satırı sonra benzer kod konuşuyorsak:

If Application.CountA(ActiveCell.EntireRow)=0 Then 
    MsgBox "Row Empty" 
    Exit Sub 
End If 

Aksi için, Arka arkaya gelen bir aralığı:

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 

(Kaynak: http://www.ozgrid.com/forum/showthread.php?t=26509&page=1)

8

WorksheetFunction.CountA(), aşağıda gösterildiği gibidir:

Dim row As Range 
Dim sheet As Worksheet 
Set sheet = ActiveSheet 

For i = 1 To sheet.UsedRange.Rows.Count 

    Set row = sheet.Rows(i) 
    If WorksheetFunction.CountA(row) = 0 Then 
     MsgBox "row " & i & " is empty" 
    End If 

Next i 
İlgili konular