Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am having a problem with the following Macro:
Sub Combine() Workbooks.Open Filename:="C:\Microsoft Office\Work\Excel\House Expense.xlsx" Range("C69:J85").Select Selection.Copy Workbooks.Open Filename:="C:\Microsoft Office\Work\Excel\Summary House.xlsx" Windows("combined.xlsx").Activate Worksheets("Sheet1").Select Range("C6").Select ActiveSheet.Paste End Sub The lines dealing with opening a File name do not go to a second line On the line: Windows("combined.xlsx").Activate I receive an error: Run-time error '9': Subscript out of range. I cannot figure this out. Appreciate any help. Thanks, Dave |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The macro is expecting you have a workbook named combined.xlsx that is
already open. If you are trying to copy information into combined.xlsx, why open the summary workbook? If you are trying to copy info into the summary workbook, I think you should remove the Windows("combined.xlsx").Activate statement. "DT" wrote: I am having a problem with the following Macro: Sub Combine() Workbooks.Open Filename:="C:\Microsoft Office\Work\Excel\House Expense.xlsx" Range("C69:J85").Select Selection.Copy Workbooks.Open Filename:="C:\Microsoft Office\Work\Excel\Summary House.xlsx" Windows("combined.xlsx").Activate Worksheets("Sheet1").Select Range("C6").Select ActiveSheet.Paste End Sub The lines dealing with opening a File name do not go to a second line On the line: Windows("combined.xlsx").Activate I receive an error: Run-time error '9': Subscript out of range. I cannot figure this out. Appreciate any help. Thanks, Dave |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Sat, 9 Feb 2008 14:19:01 -0800, paul
wrote: as stated above,if you are copying from "combined" to "house" you need to have combined open too.The windows.activate command basically is toggling from one work book or worksheet to the other All is well thank you both for the help. I always worked with Lotus and I am trying to learn Excel. Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need help to update macro to office 2007 macro enabled workbook | Excel Discussion (Misc queries) | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |