Excel Macro Help: deleting empty rows?

I'm trying to delete empty rows, but my macro is too slow.

Sub delete_test()

For i = 1 To 10000

If Range("A" & i) = "" Then

Range("A" & i).EntireRow.Delete

End If

Next i

End Sub

I try to use .select all empty row, then delete later, but it kept on selecting and unselecting.

Sub delete_test()

For i = 1 To 10000

If Range("A" & i) = "" Then

Range("A" & i).EntireRow.Select

End If

Next i

Selection.Delete

End Sub

Please Help!

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2024 Q2A.ES - All rights reserved.