![]() |
|
#8
|
||||
|
||||
|
Greg
Making a collection seems like extra effort when we could use the Bookmarks.Exists instead. Code:
Sub AnotherWay()
Dim aCell As Cell, oRng As Range, strBMName As String
For Each aCell In Selection.Range.Cells
If aCell.ColumnIndex = 1 Then
Set oRng = aCell.Range
oRng.End = oRng.End - 1
strBMName = fcnValidateBMName(Trim(oRng.Text)) 'needs Greg's function
If Not ActiveDocument.Bookmarks.Exists(strBMName) Then
ActiveDocument.Bookmarks.Add strBMName, oRng
End If
End If
Next aCell
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VBA Code to copy data from two sheet ,paste into corresponding sheet through cmdbutton | jackfruit88 | Excel Programming | 1 | 07-08-2022 09:27 PM |
| paste returns the wrong not the latest cut | Peborgh | Word | 2 | 11-23-2021 03:31 AM |
Error 4605 while trying to copy and paste with same document
|
Ilmari | Word VBA | 2 | 05-05-2020 12:08 AM |
Copy/Paste error
|
stuart255 | Office | 5 | 05-06-2019 02:13 AM |
| VBA Newbie (Trying to write a code to copy and paste info from one sheet to another) | Forum2000s | Excel Programming | 2 | 05-07-2017 04:51 AM |