Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sat, 8 Mar 2008 22:33:11 +0100, Per Jessen wrote:
Place this code in the workbook that you are copying data from. I assume that the destination workbook is opened before you run this code. Sub CopyData() Dim CopyTo As String CopyTo = InputBox("Enter name of workbook to paste data to", "Regards, Per Jessen") Workbooks("Book1").Activate ' Change to suit Sheets("Sheet5").Range("A1:B20").Copy Workbooks(CopyTo).Activate Sheets("Sheet3").Range("C1:D20").PasteSpecial Paste:=xlPasteValues End Sub Activating a workbook slows down the macro. Faster is: Sub CopyData() Dim CopyTo As String CopyTo = InputBox("Enter name of workbook to paste data to", "Regards, Per Jessen") If CopyTo = "" Then Exit Sub Application.ScreenUpdating = False Workbooks("Book1").Sheets("Sheet5").Range("A1:B20" ).Copy ' Change to suit Workbooks(CopyTo).Sheets("Sheet3").Range("C1:D20") .PasteSpecial Paste:=xlPasteValues Application.CutCopyMode = False End Sub Don <www.donwiss.com (e-mail link at home page bottom). |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying and pasting links within the same workbook | Excel Worksheet Functions | |||
VBA copying & pasting into a different workbook | Excel Programming | |||
Need to Improve Code Copying/Pasting Between Workbooks | Excel Discussion (Misc queries) | |||
Copying and pasting entire workbook | Excel Programming | |||
Streamline copying and pasting code | Excel Programming |