![]() |
|
#1
|
|||
|
|||
![]()
As far as I understand what this is about
Code:
Sub demo() Dim oRng As Range, months, k As Long If Selection.End = Selection.Start Then Exit Sub Application.ScreenUpdating = False Set oRng = Selection.Range With oRng Selection.LanguageID = wdFrenchCanadian Selection.NoProofing = False End With Application.CheckLanguage = True months = Array(Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), _ Array("janv.", "févr.", "mars", "avr.", "mai", "juin", "juill.", "aout", "sept.", "oct.", "nov.", "déc.")) With oRng.Find .ClearFormatting .Replacement.ClearFormatting .Replacement.Font.Color = 16711937 'Blue HTML 1/1/255 .MatchCase = True .MatchWildcards = True .Text = "([A-Z][a-z]{2}) ([0-9]{1;2}), ([0-9]{2})" .Replacement.Text = "\2 \1 20\3" .Execute Replace:=wdReplaceAll oRng.Expand wdWord .ClearFormatting .Replacement.ClearFormatting .Replacement.Font.Color = 16711937 .MatchCase = True .MatchWildcards = False For k = 0 To 11 .Text = months(0)(k) .Replacement.Text = months(1)(k) .Execute Replace:=wdReplaceAll Next k End With Application.ScreenUpdating = True End Sub |
#2
|
||||
|
||||
![]()
OMG, all afternoon, it kept trying and trying.
The only thing I thought of doing, was to put a font color and if it is that exact font color then do the Find and Replace. However, I left your script in black or automatic and it WORKS!!!!!! Thank you so much. This helps me so much. I can't thank you enough ![]() |
![]() |
Tags |
help me, range, selection |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Count lines within selected text range | eduzs | Word VBA | 4 | 09-17-2023 05:22 PM |
Change background of selected text | ultrarunner2020 | Word | 5 | 03-10-2023 02:59 PM |
Applying a VBA code only on a selected text or range | RobertDany | Word VBA | 2 | 10-09-2021 08:31 AM |
How to change color indicating selected text | daylee | Word | 1 | 03-27-2019 01:31 PM |
Please help. I want to change the text of a cell when another is selected | frankzelnik | Excel | 5 | 06-19-2018 01:34 PM |