Macro Help Please

D

DT

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
 
J

JMB

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.
 
P

paul

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
 
D

DT

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top