View Single Post
 
Old 12-20-2016, 01:08 AM
rocky2 rocky2 is offline Windows 10 Office 2013
Novice
 
Join Date: Feb 2016
Posts: 25
rocky2 is on a distinguished road
Default This is what I used

I am searching for a heading in a table and I need to modify it if it's not in the first 2 rows.
I can't (and don't want to) loop through the entire table. I just need to find out if the cell I found is in rows 1-2 or not.

Code:
While Selection.Find.Found
   
        If Selection.Information(wdWithInTable) Then
            Set oTable = Selection.Tables(1)
            
            iRow = Selection.Rows(1).Index
           
            If iRow > 2 Then
                Do something....
            End If
        End If
        Selection.Collapse Direction:=wdCollapseEnd
        Selection.Find.Execute
 Wend
the exception I get is run-time error 5991: Cannot access individual rows in this collection because the table has vertically merged cells.

I tried to access Selection.Range.Cells(1).RowIndex - but I get the same exception.

Thanks for your help,
Rocky
Reply With Quote