ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Copy/Paste from one workbook to another workbook (https://www.excelbanter.com/excel-programming/364802-simple-copy-paste-one-workbook-another-workbook.html)

[email protected]

Simple Copy/Paste from one workbook to another workbook
 
I am trying to do a simple Copy and Paste macro from one workbook to
certain cells in another workbook. I have the basics but I am getting
errors that the sub or fuction is not defined. Here is what I have so
far:

Sub CopyPaste()

Workbook("Customer database.xls").Activate
Rows("3:3").Select
Selection.Insert Shift:=xlDown
Selection.Clear
Workbook("Invoice template.xls").Activate
Range("B7:B13").Select
Selection.Copy
Workbook("Customer database.xls").Activate
Range("A3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Workbook("Invoice template.xls").Activate
Range("B4").Select
Application.CutCopyMode = False
Selection.Copy
Workbook("Customer database.xls").Activate
Range("K3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Workbook("Invoice template.xls").Activate
Range("B5").Select
Selection.Copy

Range("J3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Columns("K:K").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("H:H").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("F:F").EntireColumn.AutoFit
Columns("E:E").EntireColumn.AutoFit
Columns("D:D").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Columns("A:A").EntireColumn.AutoFit

End Sub

Thanks,

Mike



All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com