View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Macro that delets empty cells between cells with text

Give this macro a try...

Sub DeleteSingleBlanks()
Dim LastRow As Long, A As Range
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For Each A In Range("A1").Resize(LastRow). _
SpecialCells(xlCellTypeBlanks).Areas
If A.Count = 1 Then A.Delete xlShiftUp
Next
End Sub

--
Rick (MVP - Excel)


"andrei" wrote in message
...
Let's say i have column A with :

A1: boy
A2: empty cell
A3: girl
A4: empty cell
A5 empty cell
A6: nice

I want a macro which delets empty cells between cells with text . But the
macro should delete the cell only if there is ONE empty cell between cells
with text . If there are more than one , leaves it . In my case , it
should
delete A2 cell but should keep A4 and A5 cell because there are two empty
cells bettween cells with text , which is OK !