VBA Word : identify empty cell and aply specific format
Hello everyone
Thank you in advance for your help.
First of all, sorry for my english, if something ist not clear please ask.
I'm a beginner in VBA (and i usually work with excel)
System : Windows 10
Version : Word 2019
I have 30+ tables in a word document. I need to select all empty cells an aply a specific format (for example "standard1")
The reason : I didn't pay attention to the formats while creating the table, my bad. And now there are many different formats applied to the empty cells. Find and select doesn't work, because the cells are empty.
I found this macro (is there a way to twist it the way i need it?)
I replace the MsgBox with : Selection.Style = ActiveDocument.Styles("standard1")
And it seem to work up to the first cell with text.
Sub CheckTableCells()
Dim oCell As Cell
Dim oRow As Row
Dim MyRange As Range
For Each oRow In Selection.Tables(1).Rows
For Each oCell In oRow.Cells
If Selection.Text = Chr(13) & Chr(7) Then
oCell.Select
MsgBox oCell.RowIndex & " " & oCell.ColumnIndex & " is empty."
End If
Next oCell
Next oRow
End Sub
I wish a happy new year to everyone,
|