1. I cannot manually correct the time anymore (your first code allowed it). The time keeps updating to the current time whenever I try to correct it.
That was my mistake, corrected here I hope.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Changed As Range, rw As Range, rData As Range
Set Changed = Intersect(Target, Range("E2:H" & Rows.Count))
If Not Changed Is Nothing Then
Application.EnableEvents = False
For Each rw In Intersect(Target.EntireRow, Columns("E:H")).Rows
Set rData = Intersect(rw.EntireColumn, rw.EntireRow.Cells(1).MergeArea.EntireRow)
If Application.CountA(rData) = 0 Then
Range("L" & rData.Row).MergeArea.ClearContents
Else
Range("L" & rData.Row).Value = Now
End If
Next rw
Application.EnableEvents = True
End If
End Sub
2. The time keeps updating whenever I edit a data cell. Which is not what I need. - What I need is that the time cell registers and displays the current time only when a new cell is filled for the first time (and not edited).
This whole section is problematic and would require some sort of "cell history" to be maintained somewhere.
However, for the moment I am interested in the bold part.
Suppose cell F6 is blank on day 1, filled in with a value on day 2, cleared on day 3 and a value entered on day 4. Do you consider F6 to be filled in for the
first time on day 4 or not?
3. .. I cannot "undo" or match formatting (although there might be some workarounds to this, as you mentioned earlier).
In relation to undo, any work-around I think would be very difficult.
In relation to match formatting, if the formatting in columns E:H is uniform and you
always want to "match destination formatting" then the code could do that, either ..
- by copying the formatting from a dummy hidden row, or
- by applying the various formatting components directly, or
- as I mentioned before, use Paste Special - Values in the first place
If you want to keep all the paste options available after the paste has taken place then I don't think that will be possible with the code.