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 does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,031
Messages
5,856,936
Members
431,841
Latest member
jaybeem

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
Top