Paste selected columns from worksheet in a workbook to anotherworkbook

O

Orimslala

Hi,

I am trying to copy a selected number of columns from one workbook and
paste it into another worksheet in a second workbook.

I keep on getting an error on ActiveSheet.Paste.(ie. TargetWS.Paste
below)

How can i get round this or better still could a vb champion show me
the correct way to do this.

Thanks.

kolu


Set SrcWkb = Workbooks("source.xls")

Application.Windows("source.xls").Activate
Columns("G:I").Select
Application.CutCopyMode = False
Selection.Copy
Application.Windows("Target.xls").Activate
Columns("G:I").Select
With TargetWkb.Worksheets("sheet")
TargetWS.Paste
End With
 
O

Orimslala

Hi,

I am trying to copy a selected number of columns from one workbook and
paste it into another worksheet in a second workbook.

I keep on getting an error on ActiveSheet.Paste.(ie. TargetWS.Paste
below)

How can i get round this or better still could a vb champion show me
the correct way to do this.

Thanks.

kolu

    Set SrcWkb = Workbooks("source.xls")

    Application.Windows("source.xls").Activate
    Columns("G:I").Select
    Application.CutCopyMode = False
    Selection.Copy
    Application.Windows("Target.xls").Activate
    Columns("G:I").Select
    With TargetWkb.Worksheets("sheet")
        TargetWS.Paste
    End With

The error message i get is : object invoked has disconnected from its
cilents when i execute TargetWS.Paste
 

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

Top