View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Clear Cell Macro using an array

Bryan,

Try this alternative

Sub ClearCells()
Dim cell As Range
For Each cell In Range("A1:DD3000")
If (cell.Value Like "*110*" Or _
cell.Value Like "*111*" Or _
cell.Value Like "*112*" Or _
cell.Value Like "*113*" Or _
cell.Value Like "*114*" Or _
cell.Value Like "*115*") Then
cell.ClearContents
End If
Next cell
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bryan@KN" wrote in message
...
I'm trying to find a macro to clear cells with specific data found within.
I.E. Range A1:DD3000 and only clear cells in a range that contain
("110-115"). I.E. 70A110:70A0115. This is what I have
Sub MacroClearCell()
Dim myCell As Range

Dim myArray As Varient

myArray = Array(***110***:***115***)

Set my Cell = Range("A:E").Find(What:=myArray _ )
LookIn:=xlFormulas, _
LookAt:=xlPart)
While Not myCell Is Nothing
myCell.ClearContents
Set myCell = Range("A:E").FindNext
End Sub