Hello. Macro in attach
How to works. B3 = access level (4 or 2 = admin). IdUsers - corresponding value (also access level).
Column A takes the following values - 'u' or 'n' (depending on the access level and type of changes)
Needs following:
1. Example, if new value in D column for any access level in B3, not for 4 or 2 (example - new value in D19 - then we see, that C19 is empty, so A19 = 'n'). So, macro works wrong for only access 4 or 2 in B3, in case new value in D has not any corresponding value in C (correspondind C cell is empty) like the example above. For any other users -all ok.
2. If any value in D6:F19 changes by the same value = nothing happend (example - were "asdasd", then F2+enter in cell or mouse double-click = the same "asdasd", but macro write "u" or "n" in column A. Need to avoid that. If value changed by the same - the macro should not set 'n' or 'u' in column A (don't run macro if replacement value by same).
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column < 2 Or Target.Column > 10 Then Exit Sub
If Target.Row < 6 Then Exit Sub
Select Case Range("B3").Value
Case 4, 2
Cells(Target.Row, 1) = "u"
Case Else
Cells(Target.Row, 1) = IIf(Cells(Target.Row, 3) = Range("IdUser").Value, "u", "n") 'update
End Select
End Sub
Bookmarks