Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 04-13-2021, 07:25 PM
macropod's Avatar
macropod macropod is offline Help, FNR Wildcards Amounts in tables Cells alone Windows 10 Help, FNR Wildcards Amounts in tables Cells alone Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It seems to me your first macro could be reduced to:
Code:
Sub Demo1()
Application.ScreenUpdating = False
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  With Tbl.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Font.Color = wdColorBlue
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Text = "$[0-9,.]{1;}"
    .Replacement.Text = ""
    .Execute Replace:=wdReplaceAll
    .Text = "\($[0-9,.]{1;}\)"
    .Execute Replace:=wdReplaceAll
    .Text = "[0-9]{1;}"
    .Replacement.Text = "^&"
    .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 = "^="
    .Execute Replace:=wdReplaceAll
    .Text = "\)\)"
    .Replacement.Text = ")"
    .Execute Replace:=wdReplaceAll
  End With
Next Tbl
Application.ScreenUpdating = True
End Sub
Similarly, the second macro could be reduced to:
Code:
Sub Demo2()
Application.ScreenUpdating = False
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  With Tbl.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Font.Color = wdColorBlue
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .Replacement.Text = ""
    .Execute Replace:=wdReplaceAll
  End With
Next Tbl
Application.ScreenUpdating = True
End Sub
I see none of the 'it doesn't do it for numbers as a wildcards' issues to which you refer.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
cells, helpme, wildcards



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help, FNR Wildcards Amounts in tables Cells alone Splitting Tables containing Merged Cells bpike Word VBA 7 10-28-2020 02:23 AM
Help, FNR Wildcards Amounts in tables Cells alone How do I run code on all cells in all tables? wido Word VBA 2 09-04-2019 05:32 AM
Help, FNR Wildcards Amounts in tables Cells alone Can I repeat or self-populate cells/tables? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft