Hi all,

I am trying to copy a value in a cell based on the time stamp that is present in another cell.

For example, column A1:A288 has a time of 00:00 to 00:00 (5min increments) and Column B1:B288 has a range of data values.

I want to be able to copy say the values between 23:00 - 00:00 and paste them to another part of my work book.


I'm developing this so thought i'd start out simple and do one line to make sure the principle work fine then find a way to introduce a loop. The code I have is as follows (which doesn't work by the way):

Sub Macro2()'
' Macro2 Macro
'
    Range("A1").Select
    
If ActiveCell.Value => TIME(23, 0, 0) Then
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.Copy
    ActiveCell.Offset(0, 2).Range("A1").Select
    ActiveSheet.Paste
End If
The problem here is with line highlighted in bold. An error occurs and the code won't run any further. I know the code works past this line as I changed this to look at numbers and not times (code below) and then changed the column where the times were to all number 1s and the cell was copied.

Sub Macro2()'
' Macro2 Macro
'
    Range("A1").Select
    
If ActiveCell.Value >= 1 Then
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.Copy
    ActiveCell.Offset(0, 2).Range("A1").Select
    ActiveSheet.Paste
End If
I'm sure its my syntax to check the time of the cell as i have based this on the excel IF AND function syntax but alas, this was not the case.

Kind regards in advance

Paul