Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from another workbook
Hi, I need to some code to enable all cells on sheet 1 of workbook A to be copied into sheet 2 of workbook B. I have done this before but for some reason I get an error message sayig subscript out of range when I run the code. It would also be really goo if I could incorporate code to open workbook A from workbook B to minimise the user input even furtehr. A message bo asking for the file name would be needed. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from another workbook
Hi,
Place in Workbook B: Sub CopyWbk() ' Set wb1 = ThisWorkbook wbName = Application.InputBox("Enter workbook name", Type:=2) Workbooks.Open Filename:= _ "C:\" & wbName & ".xls" Set wb2 = Workbooks(wbName) wb1.Sheets("Sheet1").Cells.Copy wb2.Sheets("Sheet2").Range("A1") End Sub "Alan M" wrote: Hi, I need to some code to enable all cells on sheet 1 of workbook A to be copied into sheet 2 of workbook B. I have done this before but for some reason I get an error message sayig subscript out of range when I run the code. It would also be really goo if I could incorporate code to open workbook A from workbook B to minimise the user input even furtehr. A message bo asking for the file name would be needed. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
Excel-how to link source workbook to copy of destination workbook | Excel Worksheet Functions | |||
copy worksheet from closed workbook to active workbook using vba | Excel Worksheet Functions | |||
Need a macro to copy a range in one workbook and paste into another workbook | Excel Programming | |||
Copy a range of cells in an unopened workbook and paste it to the current workbook | Excel Programming |