Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Returning row info (Win XP, Word 2003)

    Hi,

    Hopefully a real brief one.

    Want to return the number of a specific row in a table.

    Say I have a table of 10 rows.
    User indicates he wants to place a specific style on say row #7

    How can I find I which row number he has selected?
    (in Excel I got .address) - what's the Word equivalent?

    Tia
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Returning row info (Win XP, Word 2003)

    You can use Selection.Information(wdEndOfRangeRowNumber). This will return -1 if the selection is not in a table. You can also use Selection.Information(wdWithInTable) to test if the selection is in a table.

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Returning row info (Win XP, Word 2003)

    Hi Henrik,

    In addition to Hans' suggestion, you can also use the RowIndex property. The following macro, which I think MS released to help users determine Word table cell addresses, shows an implementation of this:

    Cheers

    Sub CellAddress()
    If Selection.Information(wdWithInTable) = True Then
    StatusBar = "Cell Address: " & Chr(64 + Selection.Cells(1).ColumnIndex) & Selection.Cells(1).RowIndex
    End If
    End Sub
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Returning row info (Win XP, Word 2003)

    One thing to remember about rows and columns: merged cells lead to unpredictable results. Some past threads to read in which we all hit our heads against that particular brick wall...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •