Skip to main content
Support is Offline
Today is our off day. We are taking some rest and will come back stronger tomorrow
Official support hours
Monday To Friday
From 09:00 To 17:30
  Friday, 10 August 2018
  0 Replies
  2.3K Visits
0
Votes
Undo
Hi all, the code is working fine but i does not work when the worksheet is protected. although I have unprotected the column the certain column for the timestamp is. i am attaching the error message pop up. please help [attachment][/attachment] [attachment][/attachment]


Private Sub Worksheet_Change(ByVal Target As Range)
Call Micro1(Target)
Call Micro2(Target)
Call Micro3(Target)
End Sub

Private Sub Micro1(ByVal Target As Range)
If Target.Column = 1 Then
Target.Offset(0, 1).Select
ElseIf Target.Column = 2 Then
Target.Offset(1, -1).Select
End If
End Sub

Private Sub Micro2(ByVal Target As Range)
'Update 20140722
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("A:A"), Target)
xOffsetColumn = 2
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, 2).Value = Now
Rng.Offset(0, 2).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
Else
Rng.Offset(0, 2).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub

Private Sub Micro3(ByVal Target As Range)
'Update 20140722
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("H:H"), Target)
xOffsetColumn = 6
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, 2).Value = Now
Rng.Offset(0, 2).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
Else
Rng.Offset(0, 2).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub
There are no replies made for this post yet.