toangiaphat
Thành viên hoạt động



- Tham gia
- 6/5/09
- Bài viết
- 136
- Được thích
- 3
Mình muốn xóa dòng của 1 sheet thui, tên sheet trong VBA là sheet1,
thì code sau sẽ sữa như thế nào.
thanks!
Sub Xoa2()
Dim ws As Worksheet, i As Long
For Each ws In Worksheets
With ws.UsedRange
For i = .Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(.Rows(i).EntireRow) = 0 Then
.Rows(i).EntireRow.Delete
End If
Next i
End With
Next ws
End Sub
thì code sau sẽ sữa như thế nào.
thanks!
Sub Xoa2()
Dim ws As Worksheet, i As Long
For Each ws In Worksheets
With ws.UsedRange
For i = .Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(.Rows(i).EntireRow) = 0 Then
.Rows(i).EntireRow.Delete
End If
Next i
End With
Next ws
End Sub