View Single Post
 
Old 11-22-2019, 09:09 AM
geojf3 geojf3 is offline Windows 10 Office 2010
Novice
 
Join Date: Nov 2019
Posts: 6
geojf3 is on a distinguished road
Default

I created a macro with the following code to read through the first table and if there is an X, place data in the second table.


What I do not know how to do is have it run for all the documents that need to be changed/updated.


Code:
Dim strClean As String
Dim oTbl As Table
Dim Row As Integer
Dim Col As Integer
Dim strCellText As String

Set oTbl = ActiveDocument.Tables(3)

 For Row = 1 To oTbl.Rows.Count
        For Col = 1 To oTbl.Columns.Count
            strCellText = oTbl.Cell(Row, Col).Range.Text
            strClean = Mid(strCellText, 1, Len(strCellText) - 2)
            If Trim(strClean) = "X" Then
               With ActiveDocument.Tables(4).Cell(2, 3).Range
               .Text = "nailed it"
               End With
            End If
        Next
    Next
Reply With Quote