View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] imageswords.br@gmail.com is offline
external usenet poster
 
Posts: 14
Default Delete row if column A cell text length is not 11

Hi John,
this should do the trick.
You dont need to invoke the worksheet function to return the length.
Also you where testing the length of the Row
"Len(Range("A:A").Rows(i)) < 11" when you should be testing the
length of the value of the cell.
I think this is where you were going wrong.
Let me know if you have a problem

Kind regards
Bernie

-----------------------------------------------------------------------


Public Sub DeleteTheRows()
Dim i As Double 'Cant use and integer because it cant hold the value
65536.

With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
For i = Worksheets(1).Range("A:A").Rows.Count To 1 Step -1
If Len(Range("A:A").Cells(i)) < 11 Then
Range("A:A").Cells(i).EntireRow.Delete
End If
Next i
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub