Hello,

I have a VBA script that is supposed to step through each cell in a range, compare it to a value in the same cell in a different sheet. If it's different then it will update the different sheet and update the time stamp. The line that errors is -

ActiveWorkbook.Sheets("Memory").Range(cell.Address) = cell.Value

The reference in the If statement works fine -

If cell.Value <> ActiveWorkbook.Sheets("Memory").Range(cell.Address).Value

I'm sure it's just me not understanding how to set a cell in another sheet?

Here's the code I'm using :

Code:
Function Timestamp2(Reference As Range) As Date
    For Each cell In Reference
        If cell.Value <> ActiveWorkbook.Sheets("Memory").Range(cell.Address).Value Then
            ActiveWorkbook.Sheets("Memory").Range(cell.Address) = cell.Value
            Timestamp2 = Format(Now, "yyyy-mm-dd hh:mm:ss")
        Else
            Timestamp2 = ""
        End If
    Next cell
End Function