Copy and paste data range to selected cell

%3CLINGO-SUB%20id%3D%22lingo-sub-2798628%22%20slang%3D%22en-US%22%3ECopy%20and%20paste%20data%20range%20to%20selected%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2798628%22%20slang%3D%22en-US%22%3E%3CP%3ECould%20someone%20please%20write%20a%20simple%20script%20to%20copy%20and%20paste%20the%20data%20range%20(the%20rows%20and%20columns%20with%20data)%20from%20a%20named%20Excel%20project%20(workbook)%20to%20the%20highlighted%20cell%20in%20a%20different%20one%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESomething%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EwbA%20%3D%20Workbooks(%22A%22)%3C%2FP%3E%3CP%3EwbB%20%3D%20Workbooks(%22B%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EwbA.DataRange.Copy()%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EwbB.Selected.Paste()%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2798628%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Contributor

Could someone please write a simple script to copy and paste the data range (the rows and columns with data) from a named Excel project (workbook) to the highlighted cell in a different one?

 

Something like this:

 

wbA = Workbooks("A")

wbB = Workbooks("B")

 

wbA.DataRange.Copy()

 

wbB.Selected.Paste()

 

Thank you very much.

1 Reply

@jukhamil 

For example:

Sub CopyData()
    Dim wbA As Workbook
    Dim wbB As Workbook
    Set wbA = Workbooks("A")
    wbA.Activate
    ActiveSheet.UsedRange.Copy
    Set wbB = Workbooks("B")
    wbB.Activate
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub