Zain_inout
New Member
- Joined
- Sep 8, 2021
- Messages
- 18
- Office Version
- 2019
- Platform
- Windows
Hi,
I am working on a macro that will translate the French part to English. The report has a different date every month so I am only able to write a general code that will translate the month name.
For example, the cell contains "December 27, 2020 to October 2, 2021". To translate this part to French, I have written the following code:
ActiveSheet.Range("A3").Select
Selection.Replace What:=" to", Replacement:=" au", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A1").Select
ActiveSheet.Range("A3").Select
Selection.Replace What:="January", Replacement:="janvier", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="February", Replacement:="février", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="March", Replacement:="mars", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="April", Replacement:="avril", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="May", Replacement:="mai", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="June", Replacement:="juin", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="July", Replacement:="juillet", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="August", Replacement:="août", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="September", Replacement:="septembre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="October", Replacement:="octobre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="November", Replacement:="novembre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="December", Replacement:="décembre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
When the code is run, I get the following output:
"decembre 27, 2020 au octobre 2, 2021".
Now, my requirement is to have the final result as follows:
"decembre 27, 2020 au octobre 2, 2021".
Basically just interchanging the day and the month position in the cell.
Any suggestion/help is much appreciated.
I am working on a macro that will translate the French part to English. The report has a different date every month so I am only able to write a general code that will translate the month name.
For example, the cell contains "December 27, 2020 to October 2, 2021". To translate this part to French, I have written the following code:
ActiveSheet.Range("A3").Select
Selection.Replace What:=" to", Replacement:=" au", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A1").Select
ActiveSheet.Range("A3").Select
Selection.Replace What:="January", Replacement:="janvier", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="February", Replacement:="février", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="March", Replacement:="mars", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="April", Replacement:="avril", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="May", Replacement:="mai", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="June", Replacement:="juin", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="July", Replacement:="juillet", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="August", Replacement:="août", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="September", Replacement:="septembre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="October", Replacement:="octobre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="November", Replacement:="novembre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
ActiveSheet.Range("A3").Select
Selection.Replace What:="December", Replacement:="décembre", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
When the code is run, I get the following output:
"decembre 27, 2020 au octobre 2, 2021".
Now, my requirement is to have the final result as follows:
"decembre 27, 2020 au octobre 2, 2021".
Basically just interchanging the day and the month position in the cell.
Any suggestion/help is much appreciated.