Rows adding to Tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When tabbing through an existing table, when tabbing out of the last cell on
the bottom row, another row is automatically added. Is it possible to
disable this?

Thank you.
 
Alex said:
When tabbing through an existing table, when tabbing out of the last
cell on the bottom row, another row is automatically added. Is it
possible to disable this?

Thank you.

I'll assume you want to do this only for documents based on a particular
document, rather than for all documents. In that template, insert this macro
(see http://www.gmayor.com/installing_macro.htm if needed):

Sub NextCell()
Dim thisCol As Long, thisRow As Long
Dim lastCol As Long, lastRow As Long
With Selection.Tables(1)
lastCol = .Columns.Count
lastRow = .Rows.Count
End With
With Selection.Cells(1)
thisCol = .ColumnIndex
thisRow = .RowIndex
End With
If Not ((thisCol = lastCol) And (thisRow = lastRow)) Then
Selection.Cells(1).Next.Select
Selection.Collapse wdCollapseStart
End If
End Sub

The name of this macro, NextCell, makes it intercept Word's internal command
that runs when you tab in a table cell. The code figures out whether your
selection is in the last cell of the table. If it is there, then the macro
(and thus the command) does nothing; otherwise it goes to the next cell.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Someone may be able to offer you a VBA-based solution, but there is no
setting in Word as it doesn't recognize 'tabbing out of' (or 'tabbing into')
a table.

Regards |:>)
 
Back
Top