View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Ken Wright Ken Wright is offline
external usenet poster
 
Posts: 634
Default Dynamically locating value; selecting that row and everything above (or below) and deleting/copying

LOL - Now Ron's got me wondering what it really is the Op wants :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"Ron de Bruin" wrote in message
...
Hi Ken

I give one<g

Try this for below

Sub test2()
Dim Rng As Range
Set Rng = Range("A:A").Find(What:="ron", After:=Range("A" _
& Rows.Count), LookAt:=xlWhole)
If Not Rng Is Nothing Then Rows(Rng.Row & ":" & Rows.Count).delete
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ken Wright" wrote in message

...
Hi Ron - Think you missed the caveat re 'below as well'

all rows above (or below) it;


--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"Ron de Bruin" wrote in message
...
Try this

It will look for "ron" in Column A
It will delete that row and all the rows above it

Sub test()
Dim Rng As Range
Set Rng = Range("A:A").Find(What:="ron", After:=Range("A" _
& Rows.Count), LookAt:=xlWhole)
If Not Rng Is Nothing Then Rows("1:" & Rng.Row).delete
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Steven Rosenberg" wrote in message

...
How can I write a VBA macro which:

--will locate a specific value (a word) in column A of a
multi column worksheet; then

--select that cell's entire row, and all rows above (or
below) it; then

--delete the selected rows?

This non-programmer would appreciate any and all
help.

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 28/02/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 28/02/2004