mokie
07-09-2017, 08:13 AM
Hello everyone,
I've got new issue. I need to have archiving status changes if user wrote new data.
It's works almost:) good but not enough.
First problem:
If user wrote something on COLA or COLI or COLM then in column O is automatically entered (in the same row) information aubout changes (date,hour,user)
Right now status has changed after back again to to cell. Not after write and press enter button.
Conditions. In target cell: no date, no empty cell
Second problem:
Right now the status may changed after press button on click by mouse.
If user doesn't change anything on cell but only press the button in column O is automatically entered (in the same row) information aubout changes.
The better solution would be if the overwriting of data actually took place after the change in the cell, and not just after clicking without change.
Thanks in advanced.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'
'Dim str As String
'Dim ws As Worksheet
'Set ws = ActiveSheet
DoEvents
With Application
.EnableEvents = False
.DisplayAlerts = False
.ScreenUpdating = False
End With
' if change on col 1 or col 9 or col 13 then write in col 15 hour and user
If Target.Column = 1 Or Target.Column = 9 Or Target.Column = 13 Then
With ActiveCell
If ActiveCell <> "" And ActiveCell <> Date Then Cells(Target.Row, "O") = DateAdd("h", -0, Now) & " " & Environ("USERNAME")
End With
End If
With Application
.EnableEvents = True
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub
19698
I've got new issue. I need to have archiving status changes if user wrote new data.
It's works almost:) good but not enough.
First problem:
If user wrote something on COLA or COLI or COLM then in column O is automatically entered (in the same row) information aubout changes (date,hour,user)
Right now status has changed after back again to to cell. Not after write and press enter button.
Conditions. In target cell: no date, no empty cell
Second problem:
Right now the status may changed after press button on click by mouse.
If user doesn't change anything on cell but only press the button in column O is automatically entered (in the same row) information aubout changes.
The better solution would be if the overwriting of data actually took place after the change in the cell, and not just after clicking without change.
Thanks in advanced.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'
'Dim str As String
'Dim ws As Worksheet
'Set ws = ActiveSheet
DoEvents
With Application
.EnableEvents = False
.DisplayAlerts = False
.ScreenUpdating = False
End With
' if change on col 1 or col 9 or col 13 then write in col 15 hour and user
If Target.Column = 1 Or Target.Column = 9 Or Target.Column = 13 Then
With ActiveCell
If ActiveCell <> "" And ActiveCell <> Date Then Cells(Target.Row, "O") = DateAdd("h", -0, Now) & " " & Environ("USERNAME")
End With
End If
With Application
.EnableEvents = True
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub
19698