View Single Post
 
Old 11-15-2019, 10:20 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You are overcomplicating this. To bookmark the values in Column 3 with the names from Column 4: ....(see also attached)

Code:
Sub Mcr_Set_Bookmarks()
Dim BKMkName As String
Dim BkmkRange As Range
Dim oCell As Range
Dim rV As Integer
    For rV = 2 To ActiveDocument.Tables(1).Rows.Count
        Set oCell = ActiveDocument.Tables(1).Cell(rV, 4).Range
        oCell.End = oCell.End - 1 'Omit cell end character
        BKMkName = oCell.Text
        Set BkmkRange = ActiveDocument.Tables(1).Cell(rV, 3).Range
        BkmkRange.End = BkmkRange.End - 1 'Omit cell end character
        'Add the bookmark to the cell content range
        ActiveDocument.Bookmarks.Add Range:=BkmkRange, Name:=BKMkName
    Next rV
    Set oCell = Nothing
    Set BkmkRange = Nothing
End Sub
Attached Files
File Type: docm Automated_Sttements_Working_v_4.1.docm (83.3 KB, 5 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote