Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Find and delete rows

Hi and TIA. What I'm trying to accomplish is to run code that checks column
A starting at A1. Run down until it finds the word "DeleteMe" and from that
row until the end of the document delete all rows. Is that possible?
Thanks for any advice and your time.

--

Reggie

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find and delete rows

Give this macro a try...

Sub ProcessDeleteMe()
Dim DM As Range
With Worksheets("Sheet1")
On Error GoTo Done
Set DM = .Columns("A").Find(What:="DeleteMe", MatchCase:=False)
Application.Intersect(.UsedRange, Range(DM, .Cells( _
.Rows.Count, "A"))).EntireRow.Delete
End With
Done:
End Sub

--
Rick (MVP - Excel)



"JRSmith" wrote in message
...
Hi and TIA. What I'm trying to accomplish is to run code that checks
column A starting at A1. Run down until it finds the word "DeleteMe" and
from that row until the end of the document delete all rows. Is that
possible? Thanks for any advice and your time.

--

Reggie


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Find and delete rows

Rick, Thanks for the reply. Works like a charm. Exactly what I was
looking for. At first it didn't work because the cell that held the
deleteme string was a merged cell. Once I unmerged good to go. Thanks
again for your time.


"Rick Rothstein" wrote in message
...
Give this macro a try...

Sub ProcessDeleteMe()
Dim DM As Range
With Worksheets("Sheet1")
On Error GoTo Done
Set DM = .Columns("A").Find(What:="DeleteMe", MatchCase:=False)
Application.Intersect(.UsedRange, Range(DM, .Cells( _
.Rows.Count, "A"))).EntireRow.Delete
End With
Done:
End Sub

--
Rick (MVP - Excel)



"JRSmith" wrote in message
...
Hi and TIA. What I'm trying to accomplish is to run code that checks
column A starting at A1. Run down until it finds the word "DeleteMe" and
from that row until the end of the document delete all rows. Is that
possible? Thanks for any advice and your time.

--

Reggie



--

Reggie

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
find and delete rows macro clayton ledford Excel Discussion (Misc queries) 4 January 20th 09 03:34 PM
Find row and delete following rows m stroup Excel Programming 3 November 7th 08 05:58 PM
Find and delete all other rows Murray Excel Discussion (Misc queries) 1 August 7th 07 02:54 AM
Find & Delete Rows Steve Wallis Excel Programming 2 June 17th 05 07:06 AM
find and delete rows sulie[_2_] Excel Programming 2 June 7th 05 09:47 AM


All times are GMT +1. The time now is 10:12 AM.

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"