Clear Cell Macro using an array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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()
 
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)
 
Bob Phillips said:
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)




This works Fine but is it possible to write the cell value as an array If (cell.Value Like "*110:515*" Or _ and still make it work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top