Macro to delete specific rows with black cells

Apple08

Active Member
Joined
Nov 1, 2014
Messages
450
Hi All

I like to delete the rows for the range row 28 to row 45 if cells in column B are blank. Please could how can I write this macro? Thanks.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try this:
VBA Code:
Sub DeleteBlankRows()
For i = 45 To 28 Step -1
If Range("B" & i).Value = "" Then
Range("B" & i).EntireRow.Delete
End If
Next i
End Sub
 
Upvote 0
If the cells are truly blank/empty then maybe...
VBA Code:
Sub Delblank()
On Error Resume Next
Range("B28:B45").SpecialCells(4).EntireRow.Delete
End Sub
 
Upvote 0
Solution
Thank you so much, both of the macros work but the speed of the latter one is quicker. Many thanks both!
 
Upvote 0
You're Welcome & Thanks for feedback.
AND you should Mark The Post give to You Best answer (here Post #3) Not Yours. :unsure:
 
Upvote 0

Forum statistics

Threads
1,214,394
Messages
6,119,262
Members
448,880
Latest member
aveternik

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