Consulting

Results 1 to 3 of 3

Thread: URGENT! GETTING DATA FROM ONE WORKBOOK TO ANOTHER USING VARIANT

  1. #1
    VBAX Regular
    Joined
    Jun 2019
    Posts
    50
    Location

    URGENT! GETTING DATA FROM ONE WORKBOOK TO ANOTHER USING VARIANT

    Hello,
    So I have a bunch of numbers in four rows in hello1.xlsm.
    I have an empty workbook called hello2.xlsm.
    From hello2.xlsm- I want to open hello1.xlsm, get all the numbers in rows one and three, and order them onto hello1.xlsm workbook in the first and second rows respectively.
    My code is giving me a "Run time error 438, object doesn't support this property or method" on the line below where I am attempting to move the variant data I have stored onto my hello2 workbook.
    Worksheets("Sheet1").Range("A1:LF2").hello2.Value = Table

    Please help, how do I fix this?
    Attached Files Attached Files

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Try

        Worksheets("Sheet1").Range("A1:LF2").Value = Table
    
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Jun 2019
    Posts
    50
    Location
    It worked! Thank you so much!
    However, I have another issue.
    Say I wanted to get all the numbers in row 1 except the 2nd,3rd, and 4th value from hello1 workbook. Is it possible to do that in the same line I am calling the whole row in?
    This is the line that calls it:
    Table(2, j) = wbk.Worksheets("Sheet1").Range("first_value").Item(1, j)

Tags for this Thread

Posting Permissions

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