Quote:
Originally Posted by mbcohn
But there were only four rows. Now if I want to change the code to have it search for more things, I have to play around with that expression.
|
Well, that's a consequence of you not properly specifying your requirements from the outset...
Quote:
Originally Posted by mbcohn
Could you please show me how to do it with just a loop, so I'll know?
|
When I started out on this thread, I didn't even know
which table in the document you're referring to or how the table(s) are structured - not even which column the data of interest might be in. All you originally said was:
Quote:
Originally Posted by mbcohn
I have a series of documents that all contain identical formatting.
Each has a table that contains a cell with the value "Revision No."
|
Given that I still don't know how many tables there are, you might use code like:
Code:
Dim Tbl As Table, r As Long
For Each Tbl In wdDoc.Tables
With Tbl
For r = 1 To .Rows.Count
Select Case Trim(Split(.Cell(r, 1).Range.Text, vbCr)(0))
Case "Revision No.": .Cell(r, 2).Range.Text = "2.5"
Case "Published": .Cell(r, 2).Range.Text = "2 April 2021"
End Select
Next
End With
Next