Copy and Paste from one workbook to another (VBA)

PatrickO

New Member
Joined
Jul 6, 2010
Messages
36
Currently on Excel 2003...

Thought this would be easy, but I must be missing something

Code:
Sub FTEData()
Dim wksht As Worksheet
Dim wbASIS As Workbook
Dim wbBench As Workbook
Dim i As Integer
 
Set wbASIS = Workbooks("AS-IS Data.xls")
Set wbBench = Workbooks("Benchmarking.xls")
For Each wksht In wbASIS.Worksheets
    If wksht.Name = "Start" Or wksht.Name = "Roll up" Then
 
    Else
 
 
        'Copy Template to new spot
 
        wbBench.Worksheets("Template").Range("Template_Range").Copy _
        Destination:=wbBench.Worksheets("Data").Range("A1").Offset(0 + i, 0)
 
 
        'Insert worksheet name into FTE info header
        wbBench.Worksheets("Data").Range("A1").Offset(0 + i, 1).Value = wksht.Name
 
        'Copy FTE info
 
            wbASIS.Worksheets(wksht.Name).Range("V20:V79").Copy
[COLOR=red]            wbBench.Worksheets("Template").Range("A100").Paste[/COLOR]
 
        'Adjust i
        i = i + 64
 
 
    End If
 
Next wksht

I get a runtime error 438 when it gets to the red line where I am trying to paste the data.

I also attempted to use .copy Destination:=, but that did not work either.

Any help would be greatly appreciated.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top