
使用vba刪除沒(méi)有數(shù)據(jù)的行,思路大概就是或需行數(shù),使用for循環(huán),加上CountA條件,符合便使用delete進(jìn)行刪除,喜歡vba的朋友可以看看哦
sub 刪除沒(méi)有數(shù)據(jù)的行()
lastrow = Sheet1.UsedRange.Rows.Count
firstrow = Sheet1.UsedRange.Row
Myrow = lastrow + firstrow - 1
For i = Myrow To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
Rows(i).Delete
End If
Next
End Sub

