# Selecting Second to Last Row in Table



## pmgibs (Jul 3, 2019)

Is there a way to select the second to last row in a table utilizing VBA coding in a Word Document?

Thanks in advance for any help.


----------



## John_w (Jul 3, 2019)

Like this:

```
Public Sub Select_Table_Row()

    Dim tableRow As Range
    
    With ActiveDocument.Tables(1)
        Set tableRow = .Rows(.Rows.Count - 1).Range
    End With
    tableRow.Select
    
End Sub
```


----------



## pmgibs (Jul 5, 2019)

Thank you John, that worked great. Unfortunately, what I actually needed (but didn't know) was how to select the first cell of the second to last row. Is this something you could help me with, or should I open a new thread since it's a little of topic?

Thanks again for the help!

Edit: Nevermind, I found it using Selection.Cells. Code below for anyone looking in the future.


```
Selection.Cells(1).Select
```


----------



## John_w (Jul 5, 2019)

Here's another way:

```
Public Sub Select_Table_Cell()

    Dim tableCell As Range
    
    With ActiveDocument.Tables(1)
        Set tableCell = .Cell(.Rows.Count - 1, 1).Range
    End With
    tableCell.Select
    
End Sub
```


----------

