Sub ChangeFontInSecondColumn()
Dim tbl As Table
Dim r As Long, c As Long
Dim cell As cell
Dim targetCol As Long
Dim rng As Range
targetCol = 2 ' Second column
For Each tbl In ActiveDocument.Tables
With tbl
For r = 1 To .Rows.Count
On Error Resume Next ' In case cell(2) doesn't exist in a row
Set cell = .cell(r, targetCol)
If Not cell Is Nothing Then
Set rng = cell.Range
rng.End = rng.End - 1 ' Exclude end-of-cell marker
With rng.Font
.Name = "STIX Two Text"
.Size = 10
End With
End If
Set cell = Nothing
Set rng = Nothing
On Error GoTo 0
Next r
End With
Next tbl
MsgBox "Font updated in second column of all tables.", vbInformation
End Sub
No comments:
Post a Comment