View Single Post
 
Old 12-19-2013, 04:17 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,379
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Do note that your basic code won't work on tables with cells that are merged.

For code to return cell addresses in any table, try:
Code:
Sub Insert_R_C_into_every_cell()
    Dim Rng As Range, aTable As Table, TblCell As Cell, cellvalue As String
    For Each aTable In ActiveDocument.Tables
        For Each TblCell In aTable.Range.Cells
            With TblCell
                cellvalue = "Cell_ID[" & .RowIndex & ", " & .ColumnIndex & "]"
                Set Rng = .Range
                With Rng
                    .End = .End - 1
                    .Collapse wdCollapseEnd
                    .Text = cellvalue
                    .Font.Hidden = True
                End With
            End With
        Next TblCell
    Next aTable
 End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote