View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Tough Macro Question

Turn on the macro recorder then use Edit=Find and search for the term that
will mark the start of your data that you want to retain. Repeat for the
term that will mark the end of your data that you want to retain. Turn off
the macro recorder. Now you can use this to identify where to start and
where to end (modify the recorded code)

Dim rng as Range
Dim rng1 as Range
set rng = columns(1).find("Start", . . . )
set rng1 = columns(1).find("End", . . . )

range(rng1.offset(1,0),"A65536").Entirerow.Delete
range("a1",rng.offset(-1,0)).Entirerow.delete

--
Regards,
Tom Ogilvy

"Chris" wrote in message
...
Here is my problem. I have a text file that I'm importing into Excel. I
what to find a starting point (a given row) in the single column data and
tell the Macro to delete all text above that row. Then I want to find an
ending point (a given row) and tell the Macro to delete all text below

that
point.

My problem is that the starting and ending row may not be the same point
every time.

I had originally created a macro for this process, but it has predefined
starting and ending rows and will therefore delete valid data that is

needed.