Delete Empty Row Macro Works Sometimes

Parra

Well-known Member
Joined
Feb 21, 2002
Messages
752
I have the following macro to delete empty rows and it works fine, but for some weird reason it won't work when I copy paste special all the data then I edit, replace anything with 12:00:00 am, with nothing I leave the field blank , which leaves the rows blank.

Any ideas or suggestions, Thanks.

Sub DeleteEmptyRows()
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
Next r
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
The problem is the macro ? it seems just fine. Do you select everything, copy, paste as values, then replace "anything" with that hour and leave the empty cells like that ?

You should try a COUNTA in Excel in an entire row to see what you get, maybe they just "look" empty and that's why it isn't deleting them.
 
Upvote 0
I did the counta thing and I got a result of number 2. I went into each and it blank, how could I find what cell it is in?
 
Upvote 0
OK, I used counta on each cell and found out what was in there, 3 spaces. I don't know how they got there, I used edit replace to remove them and it did, except. In another cell, a 1 still appeared but no spaces. I selected it and it went away. Any suggestions? Thanks
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,044
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top