Do we have any Excel VBA experts here? | FerrariChat

Do we have any Excel VBA experts here?

Discussion in 'Other Off Topic Forum' started by PSk, Jan 13, 2013.

This site may earn a commission from merchant affiliate links, including eBay, Amazon, Skimlinks, and others.

  1. PSk

    PSk F1 World Champ

    Nov 20, 2002
    17,673
    Tauranga, NZ
    Full Name:
    Pete
    If we do I request some help please.

    I'm trying to copy a range of cells values from one workbook to another. I am able to do this other than it copies the values into the wrong worksheet and position. Nothing I can do seems to be able to change this, other than producing the many famous Excel errors.

    wSource.Sheets(1).Range("A2:G" & j).Select
    Selection.Copy
    With wDestination.Sheets(sDestination).Range("A2")
    Paste
    End With

    wSource is defined as the workbook that I open to get the data.
    wDestination is the active workbook that I am running the code from.
    sDestination is the name of the worksheet that I am trying to paste the values into.

    I was able to get this to work perfectly by copying cell by cell, but of course this was rediculously slow so I've moved to copying ranges.

    I've searched the many Google references and so far everything I've tried fails, except the above (almost but wrong worksheet).

    Thanks in advance
    Pete
     

Share This Page