View Single Post
 
Old 01-10-2024, 05:26 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Here is a shorter option which works for me and applies the red colour as you requested.
Code:
Sub Repl_Digits_W__Wds_3()
  'In selected paragraphs, replace the digits that start tabbed paras with wds.
  Dim para As Paragraph, dgt As Range, arrText() As String
  
  arrText = Split("zero one two three four five six seven eight nine", " ")
  For Each para In Selection.Range.Paragraphs
    If para.Range.Text Like vbTab & "[0-9] *" Then    'Search for only single digits:
      Set dgt = para.Range.Characters(2)
      dgt.Text = arrText(dgt.Text)
      dgt.Font.ColorIndex = wdRed
    End If
  Next para
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote