Pasting a cell into bookmarked table from excel vba

Jun 15, 2018
Reaction score
Hello, I have been looking for a way to code my workbook to copy a cell from excel and paste it into a bookmarked table I have in word. I was hoping to be able to paste it into specific cells depending on data from my worksheet. Here is what I have so for
Sub CopyAndPaste()
'opens libraries to select desired file 
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

wdApp.Visible = True
Set wdDoc = wdApp.Documents.Open(myfile)
'select the word range you want to paste into
    'and paste the clipboard contents

End Sub
How can I change this to paste the data into cell(3,4) of the table?
In addition to this, would I be able to paste in different cells depending on the data?
Ex. If range("c2") = 22 then paste in bookmark cell(2,4)
If range("C2")= 5 then paste in bookmark cell(3,4)
If range("C2")= -20 then paste in bookmark cell(4,4)

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question