Paulo_3456
New Member
- Joined
- Jul 25, 2018
- Messages
- 15
Hello everyone,
I am trying to do a very simple macro to replace date formats from MM/DD/YYYY to DD/MM/YYYY using a macro that I could use with some shortcut on my current selection on Excel :
When I execute this step by step, formula seem to work with date_fr being the right value I want but nothing happens to the cell when I execute the macro.
Does it have to do something with the cell format ?
Thank you for your help !
I am trying to do a very simple macro to replace date formats from MM/DD/YYYY to DD/MM/YYYY using a macro that I could use with some shortcut on my current selection on Excel :
Code:
Sub dateus_fr()
Dim date_us As String
Dim date_fr As String
Dim replace1 As String
date_us = Selection.Value
date_fr = Right(Left(date_us, 5), 2) & "/" & Left(date_us, 2) & "/" & Right(date_us, 4)
Selection.Offset(0, -1).Select
Selection.Offset(0, 1).Select
Selection.Value = date_fr
End Sub
When I execute this step by step, formula seem to work with date_fr being the right value I want but nothing happens to the cell when I execute the macro.
Does it have to do something with the cell format ?
Thank you for your help !