Copy and Paste

TeddyG

New Member
Joined
Feb 1, 2011
Messages
3
Hi there,

First post on the board and all that jazz so if I don't do it correctly please let me know.

I need a macro that opens two workbooks (APC1) and (APC2), selects all the information from (APC2) and pastes it after where the data ends in (APC1). This should be fairly simple but I keep getting stuck when it comes to pasting the data in at the bottom on (APC1).

Any help would be greatly appreciated.
Cheers
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Why not post the code you have attempted thus far? Use the [code]your code here[/code] tags. Also - what are the names of the source and destination sheets, how many columns, etc...
 
Upvote 0
Looks something like this at the moment.
Rich (BB code):
Sub Append_worksheet()
 
 
Workbooks.Open ("\\Sjhfs01\Information\Personal\T Mollart\APC1.csv")
Workbooks("APC1.csv").Worksheets("APC1"). _
Columns("A").NumberFormat = "#"
Workbooks.Open ("\\Sjhfs01\Information\Personal\T Mollart\APC2.csv")
Workbooks("APC2.csv").Worksheets("APC2"). _
Columns("A").NumberFormat = "#"
 
Workbooks("APC1.csv").Sheets("APC1").Activate
ActiveSheets.Cells.Select.Copy _
 
Windows("APC1.csv").Activate
Sheets.Select ("APC2")
ActiveSheet.Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
 
 
End Sub
 
Upvote 0
Scratch that, I've got a bit further...
Rich (BB code):
Sub Append_worksheet()
     
        
        Workbooks.Open ("\\Sjhfs01\Information\Personal\T Mollart\APC1.csv")
            Workbooks("APC1.csv").Worksheets("APC1"). _
            Columns("A").NumberFormat = "#"
        Workbooks.Open ("\\Sjhfs01\Information\Personal\T Mollart\APC2.csv")
            Workbooks("APC2.csv").Worksheets("APC2"). _
            Columns("A").NumberFormat = "#"
            
        Workbooks("APC1.csv").Sheets("APC1").Activate
        Sheets(1).Cells.Select
        Selection.Copy
        
        Workbooks("APC2.csv").Sheets(1).Activate
                Sheets(1).Select
                    ActiveSheet.Range("A1").Select
                        Selection.End(xlDown).Select
                            ActiveCell.Offset(1, 0).Select
                                Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                                    :=False, Transpose:=False
          
        
End Sub

Now I get this error telling me that in order to paste the whole sheet I must first select cell "A1" or something similar.
 
Upvote 0

Forum statistics

Threads
1,217,414
Messages
6,136,497
Members
450,016
Latest member
murarj

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