View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber Helmut Weber is offline
external usenet poster
 
Posts: 139
Default find and replace NUMBERS

Hi Andy,

like this:

Sub Test555()
Dim oTbl As Table
Dim oClm As Column
Dim oCll As Cell
Set oTbl = ActiveDocument.Tables(1)
Set oClm = oTbl.Columns(2)
For Each oCll In oClm.Cells
With oCll.Range.Find
.Text = "[0-9]{1,}-"
.Replacement.Text = ""
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Next
End Sub

You may as well select the column
and loop through all cells in the selection.

Sub Test555A()
Dim oCll As Cell
For Each oCll In Selection.Cells
With oCll.Range.Find
.Text = "[0-9]{1,}-"
.Replacement.Text = ""
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Next
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"