Hello.
I have a procedure to delete duplicate first cell text entries of rows in the first column of a Word table. All works fine and does as expected until the procedure comes to the last row. At the last row and after all the duplicate row first cell entries have been deleted an error message is displayed.
"Error Number 91; Description: Object variable or With block not set"

I think I can understand that the variables set
'oRow, 'oNextRow and 'oNextRow = oNextRow.Next(wdRow)
cannot compare to each other as the next row property of the procedure cannot find another row. However, I cannot (despite hours of trial and error) find a way for the procedure to complete elegantly at the last row without triggering an error message. Any help will be much appreciated.

Code below (which is triggered by a button on the my Word template.)

Public Sub DeleteDuplicateRows()
On Error GoTo ErrorHandler

' Deletes Row cells text duplicates in first table column.

Dim oTable As Table
Dim oRow As Range
Dim oNextRow As Range
Dim i As Long


' Specify which table you want to work on.
Set oTable = ActiveDocument.Tables(1)

' Set an object variable to the first row.
Set oRow = oTable.Rows(1).Range

For i = 1 To oTable.Rows.Count - 1

' Set an object variable to the next row.
Set oNextRow = oRow.Next(wdRow)


Do While oRow.Cells(1).Range = oNextRow.Cells(1).Range
If oRow.Cells(1).Range = oNextRow.Cells(1).Range Then
' If text is identical, delete the second row first cell entry
oNextRow.Cells(1).Select
Selection.Delete
Set oNextRow = oNextRow.Next(wdRow)
End If
Loop
Set oRow = oNextRow
Next i


ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit

End Sub