Hi all, and thanks in advance for any help that may be offered.
[I actually posted this q, a couple days ago, but not having received any reply, i believe it may have to do with me not being entirely clear as to what exactly it was that I was asking].
I have a couple of workers who clock in and out when they begin and finish working, by swiping a fob/chip. I then receive at the end of each week an excel sheet with a single column of data containing a long list of date and times [each cell containing the date and time of when the fob was swiped]. I receive a separate list for each worker. The first cell contains the time clocked in, and the second cell the time when he clocked out. The third, when he clocked in and the fourth when he clocked out, and so on and so forth. The attached macro code, allows me to select the entire list of data and auto copy it into a table with 2 separate columns, one for start times and one for finish, copying every second cell into the first column and every other cell into the adjacent corresponding cell, thus giving me a complete list of all the times when the work began and in the next column a list of when each working session ended.
My problem though is that the list i receive, lists all the times in the reverse, (since each new clock in/out gets added to the top of the list). Meaning that the very last cell contains the first clock in time, and the second to last the first clock out. The thirst to last cell contains the second clock in.... and so on and so forth.
As I result i need to amend the attached macro to first flip the entire row of data from last to first, and only then continue running and copying the data into the new cell as explained above.
Considering the even this first code someone kindly helped me write and I don't fully understand it either, I am totally at a loss of how to go about amending it to serve my needs.
If someone would be so kind as to help me with my issue I would be extremely grateful.
Thank you all so much.
[I actually posted this q, a couple days ago, but not having received any reply, i believe it may have to do with me not being entirely clear as to what exactly it was that I was asking].
I have a couple of workers who clock in and out when they begin and finish working, by swiping a fob/chip. I then receive at the end of each week an excel sheet with a single column of data containing a long list of date and times [each cell containing the date and time of when the fob was swiped]. I receive a separate list for each worker. The first cell contains the time clocked in, and the second cell the time when he clocked out. The third, when he clocked in and the fourth when he clocked out, and so on and so forth. The attached macro code, allows me to select the entire list of data and auto copy it into a table with 2 separate columns, one for start times and one for finish, copying every second cell into the first column and every other cell into the adjacent corresponding cell, thus giving me a complete list of all the times when the work began and in the next column a list of when each working session ended.
My problem though is that the list i receive, lists all the times in the reverse, (since each new clock in/out gets added to the top of the list). Meaning that the very last cell contains the first clock in time, and the second to last the first clock out. The thirst to last cell contains the second clock in.... and so on and so forth.
As I result i need to amend the attached macro to first flip the entire row of data from last to first, and only then continue running and copying the data into the new cell as explained above.
Considering the even this first code someone kindly helped me write and I don't fully understand it either, I am totally at a loss of how to go about amending it to serve my needs.
If someone would be so kind as to help me with my issue I would be extremely grateful.
Thank you all so much.
VBA Code:
Sub MoveRange()
Dim rng As Range
Dim InputRng As Range, OutRng As Range
On Error GoTo ErrorMessage
Dim xTitleId As String
Dim i As Long
xTitleId = "Hello"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set InputRng = InputRng.Columns(1)
For i = 1 To InputRng.Rows.Count Step 2
OutRng.Resize(1, 2).Value = Array(InputRng.Cells(i, 1).Value, InputRng.Cells(i + 1, 1).Value)
Set OutRng = OutRng.Offset(1, 0)
Next
ErrorMessage:
Exit Sub
End Sub