The code below works perfectly.
This code prevents the common change the User data.
As the sheet is used by two people (Master User, User common).
What I need is to adapt it so that when the Master User is changing some of the data, activate a UserForm.
Remembering aplanilha can not be blocked nor hidden, because two people operarm, and only one of them can change the data to another does not.
Could anyone help me?
- Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewValue As Variant, OldValue As Variant
If Target.Count > 1 Then Exit Sub
'Say you want to work with the range A1:F100
If Not Intersect(Target, Range("A1:F1000")) Is Nothing Then
NewValue = Target.Value
Application.EnableEvents = False
Application.Undo
OldValue = Target.Value
If OldValue = "" Then
Target.Value = NewValue
'ElseIf 'Before there was InputBox Then
Target.Value = NewValue
Else: MsgBox "Você não pode alterar o conteudo da celula.", 16, "Células Bloqueadas"
Target.Value = OldValue
End If
Application.EnableEvents = True
End If
End Sub