I have a workbook that captures certain data throughout the day. I'd like to capture the data in cells a1 and b1 on sheet 5 every minute starting at 09:30:00 am and ending at 16:00:00 pm for purposes of creating a daily chart. This data can be posted in cells c1:c?? and d1:d??. I currently run the below in this workbook.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime dTime, "SortItOut", , False
On Error GoTo 0
End Sub
Private Sub Workbook_Open()
dTime = Time + TimeValue("00:00:05")
Application.OnTime dTime, "SortItOut"
End Sub
Public dTime As Date
Sub SortItOut()
dTime = Time + TimeValue("00:00:05")
Application.OnTime dTime, "SortItOut"
On Error Resume Next
With Sheet20.UsedRange
.Sort Key1:=.Range("B2"), Order1:=xlAscending, Header:=xlYes
.Columns.AutoFit
End With
With Sheet25.UsedRange
.Sort Key1:=.Range("B2"), Order1:=xlAscending, Header:=xlYes
.Columns.AutoFit
End With
With Sheet58.UsedRange
.Sort Key1:=.Range("B2"), Order1:=xlAscending, Header:=xlYes
.Columns.AutoFit
End With
On Error GoTo 0
End Sub
Any help is greatly appreciated.
Gerard
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime dTime, "SortItOut", , False
On Error GoTo 0
End Sub
Private Sub Workbook_Open()
dTime = Time + TimeValue("00:00:05")
Application.OnTime dTime, "SortItOut"
End Sub
Public dTime As Date
Sub SortItOut()
dTime = Time + TimeValue("00:00:05")
Application.OnTime dTime, "SortItOut"
On Error Resume Next
With Sheet20.UsedRange
.Sort Key1:=.Range("B2"), Order1:=xlAscending, Header:=xlYes
.Columns.AutoFit
End With
With Sheet25.UsedRange
.Sort Key1:=.Range("B2"), Order1:=xlAscending, Header:=xlYes
.Columns.AutoFit
End With
With Sheet58.UsedRange
.Sort Key1:=.Range("B2"), Order1:=xlAscending, Header:=xlYes
.Columns.AutoFit
End With
On Error GoTo 0
End Sub
Any help is greatly appreciated.
Gerard