'Select active table where cursor is' command?????

D

Dave Neve

Hi

Someone gave me this macro recently but I have to change it every time I use
it on a different document.

Is there a way to get the macro to work on the table where the cursor is no
matter where the table is in the document.

A type of 'select active table where cursor is' command???

Thanks in advance.

Sub RandomPick()
'
' RandomPick Macro

Dim i As Long
Dim j As Long
i = ActiveDocument.Tables(3).Rows.Count ' table 3
Randomize
j = Int((i * Rnd) + 1)
ActiveDocument.Tables(3).Cell(j, 1).Select ' table 3

End Sub
 
H

Helmut Weber

Hi Dave,

instead of
activeDocument.Tables(3)
use
selection.tables(1)
for first table in selection

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

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