I have a table in my Word document (Table1). How do I move the insertion point to the last row of that table And, can this be done even if the insertion point is not currently located in the table Thank you.
The following is better because it does not require the insertion point to be in the table:
Dim oTable As Table Dim rngRow As Range Dim iRow As Integer Set oTable = ActiveDocument.Tables(1) iRow = oTable.Rows.Count Set rngRow = oTable.Rows(iRow).Range ActiveDocument.Tables(1).Rows(iRow).Select Selection.InsertRowsBelow
Now I'm trying to figure out how to move from cell to cell. Ideas
After a little looking around, I found the syntax I was looking for. The following line of code places the contents of textString into the second column of the first row in myTable.
THANK YOU! This post has helped me! CLICK! It does one thing unexpected though. It adds "1Row 1" to the first cell in the new row. So, I commented out the last row and I got exactly what I was looking for. Thank you very much. Now, I going to work on figuring out how to move to the next cell.
Word Macro - Moving the Insertion Point
jules_newbie
The following is better because it does not require the insertion point to be in the table:
Dim oTable As Table
Dim rngRow As Range
Dim iRow As Integer
Set oTable = ActiveDocument.Tables(1)
iRow = oTable.Rows.Count
Set rngRow = oTable.Rows(iRow).Range
ActiveDocument.Tables(1).Rows(iRow).Select
Selection.InsertRowsBelow
Now I'm trying to figure out how to move from cell to cell. Ideas
MrShadow
One way is as follows:
Sub lastrow()
Dim oTable As Table
Dim rngRow As Range
Dim iRow As Integer
Set oTable = ActiveDocument.Tables(1)
iRow = oTable.Rows.Count
Set rngRow = oTable.Rows(iRow).Range
rngRow.Collapse direction:=wdCollapseStart
rngRow.Text = "row " & iRow
End Sub
Simon Telling
After a little looking around, I found the syntax I was looking for. The following line of code places the contents of textString into the second column of the first row in myTable.
myTable.Cell(1, 2).Range.Text = textString
Rookboom