Open a workbook, Copy several cells, then Close the previously openedworkbook

E

elky.man

I want to open several workbooks (7 in total). Copy certain cells from
each workbook to a 8th workbook and then close the 7 workbooks that I
opened.

Joined Report.xls is created before this codes starts.

I started out with this code:

Sub Open_Says_Me()

Workbooks.Open Filename:="X:\Area1_7\DAILY_Area1_Area7.XLS"

Windows("DAILY_Area1_Area7.XLS").Activate

'Copy Info
Windows("DAILY_Area1_Area7.XLS").Activate
Range("D3").Select
Range("D3").Copy
Windows("Joined Report.xls").Activate
Range("D5").Select
ActiveSheet.Paste
Windows("DAILY_Area1_Area7.XLS").Activate
Range("E3").Select
Range("E3").Copy
Windows("Joined Report.xls").Activate
Range("F5").Select
ActiveSheet.Paste
Windows("DAILY_Area1_Area7.XLS").Activate
Range("F3").Select
Range("F3").Copy
Windows("Joined Report.xls").Activate
Range("H5").Select
ActiveSheet.Paste
Windows("DAILY_Area1_Area7.XLS").Activate
Range("D4").Select
Range("D4").Copy
Windows("Joined Report.xls").Activate
Range("D17").Select
ActiveSheet.Paste
Windows("DAILY_Area1_Area7.XLS").Activate
Range("E4").Select
Range("E4").Copy
Windows("Joined Report.xls").Activate
Range("F17").Select
ActiveSheet.Paste
Windows("DAILY_Area1_Area7.XLS").Activate
Range("F4").Select
Range("F4").Copy
Windows("Joined Report.xls").Activate
Range("H17").Select
ActiveSheet.Paste
ActiveWorkbook.Save
'Close BLV-PLV
Windows("DAILY_Area1_Area7.XLS").Activate
Workbooks("DAILY_Area1_Area7.XLS").Close SaveChanges:=False
'Workbooks.Open Filename:="X:\Area 2\DAILY_Area 2.XLS"

'Workbooks.Open Filename:="X:\Area 3\DAILY_Area 3.XLS"

'Workbooks.Open Filename:="X:\Area 4\DAILY_Area 4.XLS"

'Workbooks.Open Filename:="X:\Area 5\DAILY_Area 5.XLS"

'Workbooks.Open Filename:="X:\Area 6\DAILY_Area 6.XLS"

'Workbooks.Open Filename:="X:\Area 8\DAILY_Area 8.XLS"

End Sub

The workbook opens just fine, but will not copy. However; when I run
the macro using step into it works.

This macro is opened by another macro using the Application.Run
"Open_Says_Me"

I commented out the other 6 workbooks because I am stuck trying to get
this one to copy and close.
 

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