Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Tough Question | Excel Worksheet Functions | |||
Tough question moving data (may require macro?) | Excel Worksheet Functions | |||
Tough Formula question | Excel Worksheet Functions | |||
A tough macro question | Excel Discussion (Misc queries) | |||
Tough question | Excel Discussion (Misc queries) |