location of cursor in multiple table document

P

Paul

Can anyone tell me how in vba to locate the cursor in a
table and document.

I have a document with multiple tables what i want is to
create a vba procedure that the user can use to
automatically enter a new row at the end of the specific
table they are using.

So i need to loacte the table number they are in and send
the cursor to the end of the table and insert the new row.

Any ideas

Paul
 
J

Jezebel

Selection.Tables(1)

You might need to allow for the possibility that the selection spans more
than one table.
 
H

Helmut Weber

Hi Paul,
just one of several way as a start:
Dim oRng As Range
Set oRng = Selection.Range ' remember selection
Selection.Tables(1).Select
Selection.InsertRowsBelow 1
oRng.Select ' restore selection
---
Adds a row at the end of the first table
that is touched by the selection. You might like
to collapse the selection beforehand or check,
whether the cursor touches a table at all, or just
do nothing by in case, using a on error command.
Let us know if you need more help on this.
 

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