help to extract time range

WASAKI

New Member
Joined
Mar 4, 2009
Messages
3
I have a text file in the following format:
"Date","Time","Open","High","Low","Close","Up","Down"
11/25/2007,1801,1457.75,1458.25,1457.25,1457.50,501,201
11/25/2007,1802,1457.50,1458.00,1457.50,1457.75,312,128

I want to create a new file that only has the times from
9am to 5 pm for each date range, thereby eliminating
the rows that have times outside this boundary. How can I do this?
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><title></title><meta name="GENERATOR" content="OpenOffice.org 2.4 (Win32)"><style> <!-- BODY,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:"Arial"; font-size:x-small } --> </style> <table border="0" cellspacing="0" cols="1" rules="none" frame="void"> <colgroup><col width="77"></colgroup> <tbody> <tr> <td sdval="39451" sdnum="1033;0;MM/DD/YY" align="right" width="77" height="16">
</td> </tr> <tr> <td sdval="39452" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39453" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39454" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39455" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39456" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39457" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39458" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39459" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39460" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39461" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39462" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39463" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39464" sdnum="1033;0;MM/DD/YY" align="right" height="16">
</td> </tr> <tr> <td sdval="39465" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/18/08</td> </tr> <tr> <td sdval="39466" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/19/08</td> </tr> <tr> <td sdval="39467" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/20/08</td> </tr> <tr> <td sdval="39468" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/21/08</td> </tr> <tr> <td sdval="39469" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/22/08</td> </tr> <tr> <td sdval="39470" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/23/08</td> </tr> <tr> <td sdval="39471" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/24/08</td> </tr> <tr> <td sdval="39472" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/25/08</td> </tr> <tr> <td sdval="39473" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/26/08</td> </tr> <tr> <td sdval="39474" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/27/08</td> </tr> <tr> <td sdval="39475" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/28/08</td> </tr> <tr> <td sdval="39476" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/29/08</td> </tr> <tr> <td sdval="39477" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/30/08</td> </tr> <tr> <td sdval="39478" sdnum="1033;0;MM/DD/YY" align="right" height="16">01/31/08</td> </tr> <tr> <td sdval="39479" sdnum="1033;0;MM/DD/YY" align="right" height="16">02/01/08</td> </tr> <tr> <td align="left" height="16">
</td> </tr> </tbody> </table>
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Welcome to the Board

You could use a custom autofilter for Time less than 900 or time greater than 1700 and delete the visible rows.
 
Upvote 0
Try:

Code:
Sub Test()
    Dim Sh As Worksheet
    Dim Rng As Range
    Set Sh = Worksheets("Sheet1")
    Set Rng = Sh.Range("A1").CurrentRegion
    With Rng
        .AutoFilter
        .AutoFilter Field:=2, Criteria1:="<900", Operator:=xlOr, Criteria2:=">1700"
        .Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    End With
    Sh.AutoFilterMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top