floresgemini
New Member
- Joined
- Aug 25, 2015
- Messages
- 1
I have a problem with the code. the purpose of this code is to trace the changes. it does work, but it when I want to copy and paste an entire row. it only copies a single cell.
I tried to use an "If else statement" to allow the copy but my skills are focused in Java and php
I am new in this area.
Any suggestions?
I tried to use an "If else statement" to allow the copy but my skills are focused in Java and php
I am new in this area.
Code:
Option Compare Text
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const sRng As String = "A1:BJ4000"
Dim sOld As String
Dim sNew As String
Dim sCmt As String
Dim iLen As Long
Dim bHasComment As Boolean
With Target(1)
If Intersect(.Cells, Range(sRng)) Is Nothing Then Exit Sub
sNew = .Text
Application.EnableEvents = False
Application.Undo
sOld = .Text
.Value = sNew
Application.EnableEvents = True
.Interior.Color = vbGreen
sCmt = "Edit: " & Format$(Now, "dd Mmm YYYY hh:nn:ss") & " by " & Application.UserName & Chr(10) & "Previous Text :- " & sOld
If Target(1).Comment Is Nothing Then
.AddComment
Else
iLen = Len(.Comment.Shape.TextFrame.Characters.Text)
End If
If
With .Comment.Shape.TextFrame
.AutoSize = True
.Characters(Start:=iLen + 1).Insert IIf(iLen, vbLf, "") & sCmt
End With
End With
End Sub
Any suggestions?
Last edited by a moderator: