I want to delete blank cells in a range (E1:E130).
This code skips cells.
For Each cell In ranger
If cell.Value = "" Then
cell.Delete
End If
next cell
To make my objective more clear: I have a list of cells with text and empty cells in the range E1:E130 and I want to make a list starting on E1 without any empty cells.
Sorting on alphabet for instance would also be a good solution, however that didn't work out for me either.
I'd go like follows
With Range("E1:E130")
If WorksheetFunction.CountA(.Cells) > 0 Then .SpecialCells(xlCellTypeBlanks).Delete Shift:=xlShiftUp
End With
You could use the Range.SpecialCells Method to delete all blank cells in a specific range at once:
Range("E1:E130").SpecialCells(xlCellTypeBlanks).Delete
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With