View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Delete cells based on condition

Hi Terry,

Am Fri, 27 May 2016 12:10:26 +0100 schrieb Terry Pinnell:

Have to go out now so will study more carefully tonight, but first
couple of attempts gave me this error message:

https://dl.dropboxusercontent.com/u/...ro11-Error.jpg


the command has to be in one line:

Sub Test()
Dim LRow As Long, i As Long

With ActiveSheet
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To LRow
If Len(.Cells(i, 2)) = 0 And Application _
.CountIf(.Range("A3:A" & i), .Cells(i, 1)) 1 Then
.Cells(i, 1).ClearContents
End If
Next
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional