ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting blank cells in a column (https://www.excelbanter.com/excel-programming/364176-deleting-blank-cells-column.html)

bodhisatvaofboogie

Deleting blank cells in a column
 
I am wanting to select all blank cells in this column, delete the blank cell,
then have the numbers in the colums to the right of them shift over in their
place. Is this possible with a code in a macro??? THANKS!!!

Jim Thomlinson

Deleting blank cells in a column
 
Give this code a try. Change the range to whatever column you need...

Sub DeleteBlanks()
Dim rngToDelete As Range

On Error Resume Next
Set rngToDelete = Range("A:A").SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If rngToDelete Is Nothing Then
MsgBox "Nothin to Delete..."
Else
rngToDelete.Delete xlToLeft
End If
End Sub
--
HTH...

Jim Thomlinson


"bodhisatvaofboogie" wrote:

I am wanting to select all blank cells in this column, delete the blank cell,
then have the numbers in the colums to the right of them shift over in their
place. Is this possible with a code in a macro??? THANKS!!!



All times are GMT +1. The time now is 08:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com