PC Review


Reply
Thread Tools Rate Thread

Delete Cell Contents IF

 
 
joecrabtree
Guest
Posts: n/a
 
      18th Dec 2006
To all,

I have a worksheet full of numbers ( DATA1 ), I want a macro to be able
to go throught this worksheet, and delete all values that are greater
than or equal to 2000. Any ideas?

Thanks in advance

Joseph Crabtree

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      18th Dec 2006
You didn't specify but try this idea
for each c in range("a1:c100")
if c>=2000 then c.clear
next c

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"joecrabtree" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> To all,
>
> I have a worksheet full of numbers ( DATA1 ), I want a macro to be able
> to go throught this worksheet, and delete all values that are greater
> than or equal to 2000. Any ideas?
>
> Thanks in advance
>
> Joseph Crabtree
>



 
Reply With Quote
 
james.billy@gmail.com
Guest
Posts: n/a
 
      18th Dec 2006
Hi Joe,

dim xCell as range, xRng as range
xRng = Range("A1:Z2000") '<- Replace with your range
for each xCell in xRng
if xCell >= 2000 then
xcell.clearcontents
end if
next xcell

This should hopefully get you started, any problems then post back.

James

joecrabtree wrote:
> To all,
>
> I have a worksheet full of numbers ( DATA1 ), I want a macro to be able
> to go throught this worksheet, and delete all values that are greater
> than or equal to 2000. Any ideas?
>
> Thanks in advance
>
> Joseph Crabtree


 
Reply With Quote
 
Mike Fogleman
Guest
Posts: n/a
 
      18th Dec 2006
I assume you don't really want them deleted, which would shift the cells
around, but just cleared.

Sub test()
Dim rng As Range, c As Range
Set rng = ActiveSheet.UsedRange
For Each c In rng
If c.Value >= 2000 Then c.Clear
Next
End Sub

Mike F
"joecrabtree" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> To all,
>
> I have a worksheet full of numbers ( DATA1 ), I want a macro to be able
> to go throught this worksheet, and delete all values that are greater
> than or equal to 2000. Any ideas?
>
> Thanks in advance
>
> Joseph Crabtree
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete contents of cell RDC Microsoft Excel Misc 1 21st Jan 2009 04:13 PM
Delete cell contents Rob Microsoft Excel Misc 7 10th Apr 2007 12:34 PM
Delete the contents of a cell if (REVISED) mrlanier@hotmail.com Microsoft Excel Programming 7 23rd Jan 2007 10:33 PM
Delete all contents of cell but one word =?Utf-8?B?SGF5ZXR0ZSBIYXNoYW0=?= Microsoft Excel Misc 5 18th Jan 2006 08:20 AM
Delete cell contents with input to adjacent cell Ashley Frank Microsoft Excel Misc 1 5th Oct 2005 04:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:00 PM.