![]() |
#11
|
||||
|
||||
![]()
Cendrinne
Edit: I see that Paul also tidied up the code while I was posting. I think the wdFindStop could be a problem as the range may collapse as you progress through the code. It is possibly better to use wdFindContinue if you are encountering issues. You should be able to clean up your code considerably. You started by defining a range and then completely ignored it by using Selection instead. Try this cleanup on your Part 1 code and study it before applying the same principles to your Part 2 Code:
Application.ScreenUpdating = False Dim aTbl As Table, rngTable As Range For Each aTbl In ActiveDocument.Tables Set rngTable = aTbl.Range With rngTable.Find .ClearFormatting .Replacement.ClearFormatting .Replacement.Font.Color = wdColorBlue .Format = True .Forward = True .Wrap = wdFindContinue .MatchWildcards = True .Text = "[$]{1}[0-9,.]{1;}" .Replacement.Text = "" .Execute Replace:=wdReplaceAll .Text = "[$\(]{2}[0-9,.]{1;}" .Execute Replace:=wdReplaceAll .Text = "([0-9]{1;})" .Replacement.Text = "\1" .Execute Replace:=wdReplaceAll .Text = "([0-9,.]{2;})" .Execute Replace:=wdReplaceAll .Text = "([\(][0-9]{1;}[\)])" .Execute Replace:=wdReplaceAll .Text = "([\(][0-9,.]{2;}[\)])" .Execute Replace:=wdReplaceAll .Text = "(^=){1}" .Execute Replace:=wdReplaceAll .Text = "([\)])([\)])" .Replacement.Text = "\2" .Execute Replace:=wdReplaceAll End With Next aTbl It is better to not do that until your code is fully debugged as it stops you from seeing what is going on as your macro runs and makes life difficult if the code fails at any point before you turn it on again.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
cells, helpme, wildcards |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
bpike | Word VBA | 7 | 10-28-2020 02:23 AM |
![]() |
wido | Word VBA | 2 | 09-04-2019 05:32 AM |
![]() |
pvh | PowerPoint | 6 | 05-05-2015 03:21 PM |
Tables in Powerpoint - Hiding Cells | manisfeld | PowerPoint | 2 | 06-08-2014 08:17 PM |
Shading in Cells in Word Tables | Cindy | Word Tables | 1 | 01-04-2013 02:38 PM |