How to find out if an entire row is blank in excel thorough vba

后端 未结 2 1816
北海茫月
北海茫月 2020-12-03 21:15

I have a sheet in which I have data from two different sources.I\'ve a blank row between them.I want to make this blank row as my delimiter.How can I find out if the entire

2条回答
  •  萌比男神i
    2020-12-03 21:31

    WorksheetFunction.CountA(), as demonstrated below:

    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
    

提交回复
热议问题