View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default find and paste Blocks

Dim cell as Range, id as Variant
Dim rStart as Range, rEnd as Range
for each cell in selection
if cell = ID then
set rStart = cell.offset(1,0)
end if
if not rStart is nothing then
if cell.Value = "TC" then
set rEnd = cell.offset(-1,0)
exit for
end if
end if
Next
set rng = Range(rStart,rEnd)
rng.EntireRow.copy Destination:=Worksheets("Other").Range("A1")

' now you can loop through the results and delete anything that doesn't
start with GO


--
Regards,
Tom Ogilvy


"Taru" wrote:


I need to find a specific ID in a database, then paste all of the stuff
below it into a new document. Now all of the Stuff that I want to copy
starts with GO: and I want it to copy every row below the ID, until it
runs into TC. TC is the beginning of the next ID.

How do I go about making something start copying right below something
it finds for an unkown number or rows, and then stop when it sees a
specific word?


--
Taru
------------------------------------------------------------------------
Taru's Profile: http://www.excelforum.com/member.php...o&userid=35494
View this thread: http://www.excelforum.com/showthread...hreadid=553372