Compare 2 Columns in Word Table

Mattie Owens
Mattie Owens used Ask the Experts™
on
I am comparing column 4 to column 39. in table 7. Is there a easier way. It works, but seems to much. I have to compare about 30 columns to 39 , and would have to copy all each time. I think I asked before but can't find my question.

If tbl7.Cell(3, 4).Range.Text = tbl7.Cell(3, 39).Range.Text And _
    tbl7.Cell(4, 4).Range.Text = tbl7.Cell(4, 39).Range.Text And _
    tbl7.Cell(5, 4).Range.Text = tbl7.Cell(5, 39).Range.Text And _
    tbl7.Cell(6, 4).Range.Text = tbl7.Cell(6, 39).Range.Text And _
    tbl7.Cell(7, 4).Range.Text = tbl7.Cell(7, 39).Range.Text And _
    tbl7.Cell(8, 4).Range.Text = tbl7.Cell(8, 39).Range.Text And _
    tbl7.Cell(9, 4).Range.Text = tbl7.Cell(9, 39).Range.Text And _
    tbl7.Cell(10, 4).Range.Text = tbl7.Cell(10, 39).Range.Text And _
    tbl7.Cell(11, 4).Range.Text = tbl7.Cell(11, 39).Range.Text And _
    tbl7.Cell(12, 4).Range.Text = tbl7.Cell(12, 39).Range.Text And _
    tbl7.Cell(13, 4).Range.Text = tbl7.Cell(13, 39).Range.Text Then
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Retired
Top Expert 2012
Commented:
Here is one way
    Dim bEqual As Binary
   
    bEqual = True 
    For r = 3 To 13
        If tbl7.Cell(r, 4).Range.Text <> tbl7.Cell(r, 39).Range.Text Then
            bEqual = False
            Exit For
        End If
    Next r

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial