使用vba删除没有数据的行,思路大概就是或需行数,使用for循环,加上CountA条件,符合便使用delete进行删除,喜欢vba的朋友可以看看哦
sub 删除没有数据的行()
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
黄山市民网:https://www.huangshanshimin.com/