![]() |
|
#4
|
|||
|
|||
|
Sorry, I think I made that confusing. There's no need for the for loop in your code.
Do something like this: Code:
Sub CopyAndPaste()
Dim myfile, wdApp As New Word.Application, wdDoc As Word.Document
myfile = Application.GetOpenFilename(, , "Browse for Document")
Dim i As Integer
i = Application.Match("Avg", Sheet1.Range("A1:A20"), 0)
Range("E" & i).Select
Selection.Copy
wdApp.Visible = True
Set wdDoc = wdApp.Documents.Open(myfile)
'select the word range you want to paste into
If Range("c2") = 22 Then
wdDoc.Bookmarks("d22").Select
Selection.Collapse wdCollapseEnd
Selection.Paste
End If
If Range("c2") = 5 Then
wdDoc.Bookmarks("d5").Select
Selection.Collapse wdCollapseEnd
Selection.Paste
End If
If Range("c2") = -20 Then
wdDoc.Bookmarks("d20").Select
Selection.Collapse wdCollapseEnd
Selection.Paste
End If
End Sub
|
| Tags |
| bookmark, if statement, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Pasting table data so that it will wrap around the table
|
rebmaboss | Word | 1 | 11-25-2016 02:30 AM |
| Pasting text from Excel cell into word without creating a table, and keeping the in-cell formatting | hanvyj | Excel Programming | 0 | 08-28-2015 01:15 AM |
| How to insert a table using bookmarks in a document | Catty | Word VBA | 3 | 05-04-2015 03:05 AM |
Table of Bookmarks
|
Niy | Word | 3 | 03-28-2012 12:18 AM |
| Pasting table in Photoshop cutting off table | azdolfan | Word Tables | 0 | 05-16-2010 01:52 PM |