Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Tough Macro Question

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Tough Macro Question

What are the rules to determine the start and end rows.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"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.


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
Tough Question Bob Myers Excel Worksheet Functions 1 December 19th 09 04:36 PM
Tough question moving data (may require macro?) Josh Craig Excel Worksheet Functions 1 April 2nd 09 12:19 AM
Tough Formula question Bryce[_2_] Excel Worksheet Functions 1 December 30th 07 01:23 PM
A tough macro question Brad Excel Discussion (Misc queries) 0 October 17th 06 07:26 PM
Tough question SHAETY Excel Discussion (Misc queries) 8 February 17th 06 04:32 AM


All times are GMT +1. The time now is 02:43 AM.

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"