Hi Guys

Mishoshow

New Member
Joined
Sep 6, 2021
Messages
38
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. 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
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I don't know what your code is attempting to do.
Can't you just change the cell(s) to a custom format of "ddd dd/mmm/yyyy?"
 
Upvote 0
OK - I took your problem to be inability to get the date formatting you want. If it's not that, what is the problem? Specifically, what do you want (or expect) to happen, and what does happen?
 
Upvote 0
OK - I took your problem to be inability to get the date formatting you want. If it's not that, what is the problem? Specifically, what do you want (or expect) to happen, and what does happen?
everytime i entre a date after adding the code below,, the date start with the mm/dd/yy not with the dd/mm/yy,, and i tried to fix it with the format cells and i changed the windows setting and still the problem the date start with mm/dd/yy

i dont know where is the problem !!!
 
Upvote 0
How does it work in a workbook that doesn't have that code (or if you 'comment out' all the code)? I can get the date format you are looking for by changing the format of the cell.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top