Data to another worsheet in excel based on...

Closed
jessen Posts 1 Registration date Tuesday July 24, 2012 Status Member Last seen July 24, 2012 - Jul 24, 2012 at 06:52 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jul 26, 2012 at 10:10 AM
Hello,

I have got an excel file where I have collected datas each second.
I would like to copy rows of data to another worksheet based on the time column with 10 seconds increment.
Means I want data at 10:50:10, then data at 10:50:20.......etc
Can someone help me with the script.
Thanks





Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Jul 26, 2012 at 10:10 AM
Hi Jessen,

Assuming that the times are in Column A and that the first row is used as header.
Your destination sheet is referred to as Sheet2 in the code.

Adjust the following code to match your situation:
Sub MoveData()
Dim lRow, lRow2 As Integer
Dim cValue As Date
lRow = Range("A" & Rows.Count).End(xlUp).Row
For Each cell In Range("A2:A" & lRow)
cValue = cell.Value
If Right(cValue, 1) = 0 Then
lRow2 = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row
cell.EntireRow.Copy Sheets("Sheet2").Range("A" & lRow2)
End If
Next
End Sub

Best regards,
Trowa
0