View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Terry Pinnell[_4_] Terry Pinnell[_4_] is offline
external usenet poster
 
Posts: 192
Default Delete cells based on condition

Claus Busch wrote:

Hi Terry,

Am Thu, 26 May 2016 20:58:45 +0100 schrieb Terry Pinnell:

https://dl.dropboxusercontent.com/u/...eSomeCells.jpg


try:

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.


Thanks for the fast reply, Claus, much appreciated.

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

--
Terry, East Grinstead, UK