I have a protected and shared worksheet sheet with 3 user access, 2 users has their own password to work in their selected ranges and one user range is without password, reset of the sheet is protected for all.
I am using macro for timestamp, but when macro unprotect the sheet, it goes open for other user too and also when macro protect the sheet Allow user to edit the range doesn’t apply.
I just copied the code coz I don’t know vba, below is the code anyone please help me to resolve this issue.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("Q5:Q20000, AF5:AF20000"), Target) Is Nothing Then
Sheet6.Unprotect ("af2228")
Application.EnableEvents = False
With .Offset(0, -1)
.NumberFormat = "dd/mmm/yy hh:mm am/pm"
.Value = Now()
End With
Application.EnableEvents = True
Sheet6.Protect ("af2228"), UserInterfaceOnly = True, AllowFiltering = True
End If
If Not Intersect(Range("A5:A20000"), Target) Is Nothing Then
Sheet6.Unprotect ("af2228")
Application.EnableEvents = False
With .Offset(0, 1)
.NumberFormat = "dd/mmm/yy hh:mm am/pm"
.Value = Now()
End With
Application.EnableEvents = True
Sheet6.Protect ("af2228"), UserInterfaceOnly = True, AllowFiltering = True
End If
End With
End Sub
Moderator Note:
Pls add code tags around your code as per forum rule#3.
Bookmarks