Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Delete Cell Contents IF

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Delete Cell Contents IF

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

"joecrabtree" wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Delete Cell Contents IF

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Delete Cell Contents IF

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" wrote in message
ups.com...
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
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
Delete the contents of a cell if it contains #DIV/0! Automaticall. GoodyA10 Excel Discussion (Misc queries) 4 April 27th 10 03:45 PM
Delete ROW based on Cell Contents HeatherJ Excel Discussion (Misc queries) 4 February 11th 10 04:25 PM
delete contents of cell RDC Excel Discussion (Misc queries) 1 January 21st 09 04:13 PM
Delete cell contents Rob[_4_] Excel Discussion (Misc queries) 7 April 10th 07 12:34 PM
Delete Row based on cell contents Steph[_6_] Excel Programming 6 November 1st 05 07:48 PM


All times are GMT +1. The time now is 03:32 PM.

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"