Mishoshow
New Member
- Joined
- Sep 6, 2021
- Messages
- 38
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- Windows
i have that code and i don't know where is the problem
everytime i entre a date it began with the month mm/dd/yyyy and i want to start it with the day dd/mm/yyyy
i changed the date format from excel nothing changed,, i changed the date from windows setting nothing else changed.
can anyone help me please
Private Sub Worksheet_Change(ByVal Target As Range)
Const xRg As String = "A8:AO761"
Dim strOld As String
Dim strNew As String
Dim strCmt As String
Dim xLen As Long
With Target(1)
If Intersect(.Cells, Range(xRg)) Is Nothing Then Exit Sub
strNew = .Text
Application.EnableEvents = False
Application.Undo
strOld = .Text
.Value = strNew
Application.EnableEvents = True
strCmt = "Edit: " & Format$(Now, "dd Mmm YYYY") & " by " & _
Application.UserName & Chr(10) & "Previous Text :- " & strOld
If Target(1).Comment Is Nothing Then
.AddComment
Else
xLen = Len(.Comment.Shape.TextFrame.Characters.Text)
End If
With .Comment.Shape.TextFrame
.AutoSize = True
.Characters(Start:=xLen + 1).Insert IIf(xLen, vbLf, "") & strCmt
End With
End With
End Sub
everytime i entre a date it began with the month mm/dd/yyyy and i want to start it with the day dd/mm/yyyy
i changed the date format from excel nothing changed,, i changed the date from windows setting nothing else changed.
can anyone help me please
Private Sub Worksheet_Change(ByVal Target As Range)
Const xRg As String = "A8:AO761"
Dim strOld As String
Dim strNew As String
Dim strCmt As String
Dim xLen As Long
With Target(1)
If Intersect(.Cells, Range(xRg)) Is Nothing Then Exit Sub
strNew = .Text
Application.EnableEvents = False
Application.Undo
strOld = .Text
.Value = strNew
Application.EnableEvents = True
strCmt = "Edit: " & Format$(Now, "dd Mmm YYYY") & " by " & _
Application.UserName & Chr(10) & "Previous Text :- " & strOld
If Target(1).Comment Is Nothing Then
.AddComment
Else
xLen = Len(.Comment.Shape.TextFrame.Characters.Text)
End If
With .Comment.Shape.TextFrame
.AutoSize = True
.Characters(Start:=xLen + 1).Insert IIf(xLen, vbLf, "") & strCmt
End With
End With
End Sub