Copy from one workbook and paste in another with VBA

davidkhbgh

New Member
Joined
Jan 2, 2006
Messages
40
I am trying to copy a range from one workbook to a range in another workbook:


Code:
    'print pallet tag
    If ProductionData.CheckBox1.Value = True Then
        ActiveCell.Offset(0, 5) = "Skid Complete"
        
        Dim endCell As Range
        Set endCell = ActiveCell.Offset(0, 2)
        
        Dim sngSkidNumber As Single
        sngSkidNumber = Range("E8").Value
        Workbooks("Tally Sheet ver7.2.xls").Sheets("Pallet Tag").Range("B3").Value = sngSkidNumber
        'Range("B3").Value = sngSkidNumber
        ActiveWorkbook.Sheets("ProductionRecord").Activate
        
        'find top of range
        Dim os As Integer
        For x = endCell.Row - 1 To 11 Step -1
            os = endCell.Row - x
            If endCell.Offset(-os, 3).Text = "Skid Complete" Or x = 11 Then
                Dim startCell As Range
                Set startCell = endCell.Offset(-os + 1, -2)
                Exit For
            End If
        Next x
        
        'Debug.Print "Start: " & startCell.Column & ":" & startCell.Row
        'Debug.Print "End: " & endCell.Column & ":" & endCell.Row
            
        Range(Cells(startCell.Row, startCell.Column), Cells(endCell.Row, endCell.Column)).Select
        Selection.Copy
        Workbooks("Tally Sheet ver7.2.xls").Sheets("Pallet Tag").Range("C3").Selection.Paste
        Workbooks("Tally Sheet ver7.2.xls").Sheets("Pallet Tag").PrintOut Copies:=1
        Workbooks("Tally Sheet ver7.2.xls").Sheets("Pallet Tag").Selection.ClearContents
        
        Sheets("ProductionRecord").Select
    End If

a message tells me this object does not support this method:

Code:
Workbooks("Tally Sheet ver7.2.xls").Sheets("Pallet Tag").Range("C3").Selection.Paste

Any help would be appriciated.

Dave
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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