HELP : Open 2nd Workbook, copy, close and paste

MooseMoney

New Member
Joined
Jan 10, 2012
Messages
33
Grrrrr! I have been battling with this for a couple of hours now, searched and is still battling!

1. The user is working in a workbook called "SpareParts".
2. I now need him to select and open another workbook form a number of available workbooks in the "C\MyFiles" directory.
3. In the newly opened workbook, the data in "Sheet1!A1..F600" to be copied and this workbook can then to be closed.
4. The copied data to be pasted (as values) at "Sheet13!B2" in the "SpareParts" workbook.

This might be a simple macro but I am really struggling to get this to work.
Your assistance will be appreciated!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hello, try:
Code:
Sub test()
Dim sPt$, sFl$
sPt = Application.GetOpenFilename()
Workbooks.Open (sPt)
Worksheets("Sheet1").Select
Range("A1:F600").Select
Selection.Copy
Workbooks("SpareParts").Activate
Worksheets("Sheet13").Select
Range("B2").Select
ActiveSheet.Paste
sFl = Mid(sPt, InStrRev(sPt, "\") + 1)
Workbooks(sFl).Activate
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Thank you for your response!
However, this is also where I get stuck!

The module code breaks at:
Worksheets("Sheet1").Select
 
Upvote 0
Hello,
3. In the newly opened workbook, the data in "Sheet1!A1..F600"
Is in newly opened workbook worksheet with name "Sheet1"? If not, change to correct name or use code
Code:
Worksheets(1).Select
where 1 is the number position of Worksheet
 
Upvote 0

Forum statistics

Threads
1,212,098
Messages
6,105,952
Members
447,986
Latest member
dicklim39

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top