View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default Search and replace blank cells with "N/A" within a Word Table

Sub Scratchmacro()
Dim oTbl As Word.Table
Dim oCell As Word.Cell
For Each oTbl In ActiveDocument.Range.Tables
For Each oCell In oTbl.Range.Cells
If Len(oCell.Range.Text) = 2 Then
oCell.Range.Text = "N/A"
End If
Next oCell
Next oTbl
Set oTbl = Nothing
Set oCell = Nothing
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


wrote:
All:
I have done some research, but no luck on my part. I have
approximately 100 test scenarios that need to be updated. The
scenarios were written in Word and instead of the test writer putting
in "N/A" for a blank cell, they, in fact, left it Blank.

So, I would like to know if someone could help me where I have a macro
that searches the document and places the word "N/A" in place of any
empty cell within a table in a document.

Thank you.
Gene