LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Delete all cells with a "x" in them

Try,

for i = 363 to 1 step -1
If Sheets("CDPTS").Range("B" & i).Value = "x" Then
Sheets("CDPTS").Range("B" & i).Delete Shift:=xlUp
End If
Next Cell

Cecil

"scrabtree23" wrote in message
...
I want to delete all cells in a range that have "x" in
them. I have used the following code:

For Each Cell In Sheets("CDPTS").Range("B1:B363")
If Cell.Value = "x" Then
Cell.Delete Shift:=xlUp
End If
Next Cell

However, this doesn't delete them all? I repeated the
code several times and it finally does get them all. Is
there a more reliable code to do my job?

SDC



 
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
how can I disable "cutting cells" and "drag and drop "in excel ? mwoody Excel Worksheet Functions 4 August 25th 08 03:53 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
DELETE CELLS w/ "DIV/0" MACRO Tim H[_2_] Charts and Charting in Excel 4 January 17th 08 07:53 PM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
Any way to use toolbar button to delete cells and move cells "up"? Texas-Ron Excel Discussion (Misc queries) 2 April 7th 07 06:33 PM


All times are GMT +1. The time now is 04:52 PM.

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

About Us

"It's about Microsoft Excel"