Insert row at the end of a table

Q

Question Boy

I have a table with 2 rows. The first is the header and the 2nd is a
'template' row that I wish to copy and insert below as required through a
loop. The issue is that the row is actually comprised of 2 row which have
been merged together in 3 out of 4 table columns and I can't get the code to
properly copy the row and paste it. Can anyone help?

If I select the bottom of the split rows, it only insert a single column/row
below that perticular row. If I select the row, it does not select the
bottom cell of the split column and insert the row above the split?!

Is there not a way to copy and paste the last row and insert a copy below
the last row of the table?

Thank you,

QB
 
Q

Question Boy

For instance when I try to copy the last 2 row (actually 1 row to me, but
word seem to view it as 2), I get the following error:

"Cannot access individual rows in this collection because the table has
vertically merged cells."
 
J

Jay Freedman

Essentially, the error message you quoted says it all: VBA cannot copy, paste,
or enumerate table rows or columns that contain merged (or split) cells. It can
access individual cells, but it can't manipulate them more than one at a time.

There are two approaches you can use:

1. Create a one-row table, merge or split the cells as needed, and store that
whole table as an AutoText entry in your template. When you need another row,
have the macro insert the AutoText entry at the end of the existing table.

2. Have the macro do the entire sequence of inserting a new row and
merging/splitting its cells in the same way as the original.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top