View Single Post
  #6   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 Fri, 27 May 2016 12:10:26 +0100 schrieb Terry Pinnell:

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


try it this way:

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

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


Regards
Claus B.


Brilliant, you're a star! Both of those worked, and for both of the
scenarios.

I'd got a sort of result by abandoning VBA and writing my own macro.
But apart from being unreliable it was glacially slow by comparison
with your macro.

Thank you so much.

--
Terry, East Grinstead, UK