S
simmo
Hi all,
I have been using this macro to highlight names in a table in word.
Is it possible to modify it, so it will highlight the row that the
name is on in the table with a cell fill colour of say blue.
Thanks
Justin
Sub Namesred()
'
' Macro2 Macro
' Macro recorded 28/04/2008 by Simmo
'
Dim rDcm As Range
Dim x As Long
Dim arrU() As String
Dim arrB() As String
arrU = Split("Y Age%M Arnold%N Barras%K Billing %J Wood", "%")
arrB = Split("RECORD", ",") ' bold
For x = 0 To UBound(arrU)
Set rDcm = ActiveDocument.Range
With rDcm.Find
..Text = "<" & arrU(x) & ">"
..MatchWildcards = True
..Replacement.Font.Color = wdColorRed
..Replacement.Text = "^&"
..Execute Replace:=wdReplaceAll
End With
Next
For x = 0 To UBound(arrB)
Set rDcm = ActiveDocument.Range
With rDcm.Find
..Text = "<" & arrB(x) & ">"
..MatchWildcards = True
..Replacement.Font.Bold = True
..Replacement.Text = "^&"
..Execute Replace:=wdReplaceAll
End With
Next
ActiveDocument.Range(0, 0).Select
End Sub
I have been using this macro to highlight names in a table in word.
Is it possible to modify it, so it will highlight the row that the
name is on in the table with a cell fill colour of say blue.
Thanks
Justin
Sub Namesred()
'
' Macro2 Macro
' Macro recorded 28/04/2008 by Simmo
'
Dim rDcm As Range
Dim x As Long
Dim arrU() As String
Dim arrB() As String
arrU = Split("Y Age%M Arnold%N Barras%K Billing %J Wood", "%")
arrB = Split("RECORD", ",") ' bold
For x = 0 To UBound(arrU)
Set rDcm = ActiveDocument.Range
With rDcm.Find
..Text = "<" & arrU(x) & ">"
..MatchWildcards = True
..Replacement.Font.Color = wdColorRed
..Replacement.Text = "^&"
..Execute Replace:=wdReplaceAll
End With
Next
For x = 0 To UBound(arrB)
Set rDcm = ActiveDocument.Range
With rDcm.Find
..Text = "<" & arrB(x) & ">"
..MatchWildcards = True
..Replacement.Font.Bold = True
..Replacement.Text = "^&"
..Execute Replace:=wdReplaceAll
End With
Next
ActiveDocument.Range(0, 0).Select
End Sub