View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BrianB BrianB is offline
external usenet poster
 
Posts: 1
Default Delete all cells with a "x" in them

You are using the wrong code. It should be :-
'-------------------------------------
Sub test()
For Each c In Sheets("CDPTS").Range("B1:B363").Cells
If c.Value = "x" Then
c.ClearContents
End If
Next
End Sub
'------------------------------------------

It is bad programming practice to use a 'reserved word' in a macro. In
this case "Cell" already has meaning in VBA. You may get away with it
sometimes, but this can cause chaos in a large program - or when Excel
decides it has had enough.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/