Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve current row # from table in word

Status
Not open for further replies.

dscs

Programmer
Feb 26, 2005
5
US
I have a table that has 12 rows. The user can click on the 1st column in each row which has the same entry macro in it. I want to be able to determine which row the user came from so that I can clear out that row and all rows till the end of the table, then do other processing.

Is there a way to retrieve the row # (RowIndex) of the Row the user was in? I tried

CurrentRowNum = ActiveDocument.Tables(9).Cell_
(Selection.Information(wdWithInTable), 1).RowIndex

It brings back Row # = 12 (last row in the table).

Thanks for your help!!
 
Hi dscs,

About the easiest is
Code:
[blue]Selection.Rows(1).Index[/blue]

From what you say this code will only be executed when the selection is within your table so there should be no need for any extra checking.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top