Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy to new workbook

I created this code to copy info from one book to another. I need to change
it so that the information can be copied over into the new book because
currently it only copies over into the workbook "book2". can anyone help?
Here is my code:

Private Sub CommandButton20_Click()
Workbooks.Add
Windows("Product Calculator1.xls").Activate
Columns("A:D").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Windows("Product Calculator1.xls").Activate
Columns("H:H").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
range("E1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
range("F1").Select
Windows("Product Calculator1.xls").Activate
Columns("K:K").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
range("G1").Select
Windows("Product Calculator1.xls").Activate
Columns("N:N").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
range("H1").Select
Windows("Product Calculator1.xls").Activate
Columns("Q:Q").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
range("I1").Select
Windows("Product Calculator1.xls").Activate
Columns("R:R").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
range("J1").Select
Windows("Product Calculator1.xls").Activate
Columns("S:S").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book2").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
range("J1").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Application.CutCopyMode = False
Windows("Product Calculator1.xls").Activate
range("S1").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default copy to new workbook


Suppose your current workbook is Book1.xls

You have another workbook open called Book2.xls with 1 worksheet Sheet1

Book1 being the active workbook

Range("A1:D200").copy

Workbooks("Book2").Sheets("Sheets1").Range("A1").P asteSpecial
Application.CutCopymode = False

' Contents of A1:D200 will be copied into the new workbook

HTH

Rgds
Raymond

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook Ruchir Excel Worksheet Functions 1 July 25th 08 07:29 AM
Excel-how to link source workbook to copy of destination workbook D Lynn Excel Worksheet Functions 1 May 29th 08 05:36 PM
Copy cells based on conditions in one workbook to another workbook fLiPMoD£ Excel Discussion (Misc queries) 0 August 1st 07 07:43 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM


All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"