Results 1 to 2 of 2

Thread: 2 Workbooks, Workbooks.Worksheets.DataBodyRange(col,row) = Value Pastes to Wrong Workbook
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jul 2016
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 2 Workbooks, Workbooks.Worksheets.DataBodyRange(col,row) = Value Pastes to Wrong Workbook

    Hey!

    Goal:
    I have two workbooks open, the code sends information from one workbook to the other.


    Code:
    Dim tbSendTo As ListObject
    Set tbSendTo = Workbooks(wbName_SendTo).Worksheets(wsName_SendTo).ListObjects(tbName_SendTo)
    
    tbSendTo.DataBodyRange(Row, colInput) = returnValue
    Problem:
    The code is pasting into the wrong workbook. Despite tbSendTo referencing the correct workbook, my code is pasting back into my tbObtainFrom workbook.


    Is there a way to use the DataBodyRange qualifier while keeping the reference to the proper workbook?

    Thanks!!
    Last edited by Marmit424; Sep 5th, 2019 at 11:52 AM.

  2. #2
    Board Regular
    Join Date
    Jul 2016
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: 2 Workbooks, Workbooks.Worksheets.DataBodyRange(col,row) = Value Pastes to Wrong Workbook

    Turned out it was an ID-10-T error.

    Just put the wrong listobject reference identifier when I was refactoring my code.

    Cheers!

    Quote Originally Posted by Marmit424 View Post
    Hey!

    Goal:
    I have two workbooks open, the code sends information from one workbook to the other.


    Code:
    Dim tbSendTo As ListObject
    Set tbSendTo = Workbooks(wbName_SendTo).Worksheets(wsName_SendTo).ListObjects(tbName_SendTo)
    
    tbSendTo.DataBodyRange(Row, colInput) = returnValue
    Problem:
    The code is pasting into the wrong workbook. Despite tbSendTo referencing the correct workbook, my code is pasting back into my tbObtainFrom workbook.


    Is there a way to use the DataBodyRange qualifier while keeping the reference to the proper workbook?

    Thanks!!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •