Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2006
    Posts
    63
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Specify current cell in Word (Word)

    I'm sure I've seen this somewhere before, but can find it again. How do you specify the current cell in a Word table?

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

    Re: Specify current cell in Word (Word)

    Try Selection.Cells(1).

    For example, the row number of the current cell is Selection.Cells(1).RowIndex. If the selection is not in a table cell, this will cause an error; you can check as follows:

    If Selection.Information(wdWithinTable) Then
    MsgBox "Current cell in row " & Selection.Cells(1).RowIndex
    Else
    MsgBox "Selection not in a table cell"
    End If

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,120
    Thanks
    2
    Thanked 439 Times in 362 Posts

    Re: Specify current cell in Word (Word)

    Hi David,

    You could try:<pre>Sub CellAddress()
    If Selection.Information(wdWithInTable) = True Then
    If Selection.Cells(1).ColumnIndex > 26 Then
    StatusBar = "Cell Address: " & Chr(64 + Int(Selection.Cells(1).ColumnIndex / 26)) & _
    Chr(64 + (Selection.Cells(1).ColumnIndex Mod 26)) & Selection.Cells(1).RowIndex
    Else
    StatusBar = "Cell Address: " & Chr(64 + Selection.Cells(1).ColumnIndex) & _
    Selection.Cells(1).RowIndex
    End If
    End If
    End Sub</pre>

    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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