S
simmo
Hi All
I am trying to use this macro to search a word doc that contains a
table. Within the table there are lot of columns and rows that contain
times and numbers which for ease of explanation I will call cells hope
this is the right terminology.
I would like to highlight a single cell that contains just the number
14 but this macro will highlight all 14’s within the doc including the
times for instance 10:14
Is it possible to target single cells that contain just the numbers 14
on their own.
I am new to macros so this one may look crude
If this is relatively easy my final aim is to create a macro that can
search for say five different numbers and highlight them different
colours.
Thank you
Sub 14light()
'
' Macro1 Macro
' Macro recorded 10/19/2008 by sim
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "14"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
While Selection.Find.Found
Selection.MoveLeft Unit:=wdCharacter, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Wend
End Sub
I am trying to use this macro to search a word doc that contains a
table. Within the table there are lot of columns and rows that contain
times and numbers which for ease of explanation I will call cells hope
this is the right terminology.
I would like to highlight a single cell that contains just the number
14 but this macro will highlight all 14’s within the doc including the
times for instance 10:14
Is it possible to target single cells that contain just the numbers 14
on their own.
I am new to macros so this one may look crude
If this is relatively easy my final aim is to create a macro that can
search for say five different numbers and highlight them different
colours.
Thank you
Sub 14light()
'
' Macro1 Macro
' Macro recorded 10/19/2008 by sim
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "14"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
While Selection.Find.Found
Selection.MoveLeft Unit:=wdCharacter, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Wend
End Sub