Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear Cell Macro using an array

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear Cell Macro using an array



"Bob Phillips" wrote:

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



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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with macro to copy, paste, and clear cell values Anthony[_5_] Excel Discussion (Misc queries) 8 December 21st 09 02:11 PM
Transfer a name from one cell to another but leave clear if clear? Scoober Excel Worksheet Functions 3 May 22nd 09 02:55 AM
Clear Cell based on event w/o macro? Paul987 Excel Worksheet Functions 2 October 27th 05 08:44 PM
Clear/Delete an Array Raul[_4_] Excel Programming 5 May 13th 04 10:12 PM
MACRO TO CLEAR CELL CONTENTS Jay Dean Excel Programming 2 October 11th 03 02:51 PM


All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"