View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
charles charles is offline
external usenet poster
 
Posts: 124
Default Delete Blank Cells in a Row

Hi
This works very well, but it is looping at the "End If" statement

Regards

Charles

"Gary''s Student" wrote:

Sub squeezeBlanks()
Dim n As Long, i As Long
Dim j As Long
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
k = Cells(i, Columns.Count).End(xlToLeft).Column
For j = k To 2 Step -1
With Cells(i, j)
If IsEmpty(.Value) Then
.Delete Shift:=xlToLeft
End If
End With
Next
Next
End Sub

--
Gary''s Student - gsnu200837