Good morning.
Thanks for the help, but it's not correct.
It needs to count the cell "I8" if it is greater than 1, so that with the second change that will be made in the cell "E8", then it will put the user's name in the cell "H8".
The one with the change I make from "C8 "E8", it then writes to the plus 2 cells.
It also has not only the code workbook, but also every sheet in my own file.
I can't put the original excel file, because it is close to 4mb. Even though I compress it to a zip that the page accepts, it still comes to 1,600mb. There is also 7zip and winrar, which download it under 1mb, but the forum does not accept them.
I tried something like this and worked.
If you have a better solution please.
Thank you.
Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim cell As Range
If Not Intersect(Target, Range("C:E")) Is Nothing Then
'ActiveSheet.Unprotect "mypass"
For Each cell In Intersect(Target, Range("C:E"))
Columns(6).AutoFit
Columns(7).AutoFit
If Cells(cell.Row, "I").Value > 1 Then
If cell.Value <> "" Then
Cells(cell.Row, "F").Value = Now()
Cells(cell.Row, "H").Value = Environ$("UserName")
Else
Cells(cell.Row, "F").ClearContents
Cells(cell.Row, "H").ClearContents
End If
Else
If cell.Value <> "" Then
Cells(cell.Row, "F").Value = Now()
Cells(cell.Row, "G").Value = Environ$("UserName")
Else
Cells(cell.Row, "F").ClearContents
Cells(cell.Row, "G").ClearContents
End If
End If
Next cell
'ActiveSheet.Protect "mypass"
End If
End Sub