Select Row in word table

G

gb0dms

This my be so easy I’m not seeing the trees from the forest but, I am trying
to simply select the row of a word table, in which my cursor is currently in.
The problem is I want to run this on a variety of tables with various row
and column combinations
 
S

StevenM

To: Gb0dms,

In order to select a row where the cursor is at you need:

Selection.rows(1).Select

Steven Craig Miller
 
G

Gordon Bentley-Mix

gb0dms,

Steven's code will do what you need - select the entire row in which your
cursor is located. However, please be aware that it will fail if your cursor
in not in a table. To accomodate this possibility check the
..Information(wdWithinTable) property of the Selection object first.

In addition, you may run into problems if you have any "vertically merged"
cells _anywhere_ in the table, although "horizontally merged" cells are OK.
(Of course, if you want to select a column then the reverse applies...)

Finally, please note that the .Delete method of the resulting Selection
object will just delete the contents of the table cells. If you want to
"delete" the row, you will need to use the .Cut method.
--
Cheers!
Gordon

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 
M

macropod

Hi gb0dms,

If Selection.Information(wdWithInTable) Then Selection.Range.Rows.Select
will select as many entire rows as you have rows within one or more columns selected.
 

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