Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default If cell contains a pattern delete the row

I would like to delete a row if a cell (say "F") contains a
certain pattern (say "abc"). Example:

If cell F of row 125 is "bcabcdd" it should be deleted.

How can this be done?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default If cell contains a pattern delete the row

When you say delete the row, if you mean delete the contents then use option
1 below, if you mean delete the contents
and remove the space created use option 2.


' option 1
If Range("F125") = "bcabcdd" Then Rows(125).ClearContents

'option 2
If Range("F125") = "bcabcdd" Then Rows(125).Delete Shift:=xlUp

--
Cheers
Nigel



"John Smith" wrote in message
...
I would like to delete a row if a cell (say "F") contains a
certain pattern (say "abc"). Example:

If cell F of row 125 is "bcabcdd" it should be deleted.

How can this be done?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default If cell contains a pattern delete the row

If Range("F2").Value Like "*abc*" Then
Range("F2").EntireRow.Delete
End If

--
HTH

Bob Phillips

"John Smith" wrote in message
...
I would like to delete a row if a cell (say "F") contains a
certain pattern (say "abc"). Example:

If cell F of row 125 is "bcabcdd" it should be deleted.

How can this be done?



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
removing cell pattern yogart Excel Discussion (Misc queries) 3 February 6th 09 04:28 AM
How to find & delete a particular pattern of text from values of a Mansa Excel Discussion (Misc queries) 10 June 3rd 08 08:26 AM
Cell pattern BBlue Excel Discussion (Misc queries) 0 March 23rd 06 08:49 PM
Cell pattern Gary''s Student Excel Discussion (Misc queries) 0 March 23rd 06 08:49 PM
Cell Pattern Peter M Excel Discussion (Misc queries) 2 January 11th 05 02:13 AM


All times are GMT +1. The time now is 09:05 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"