Copy range from unopen workbook to current workbook

Joined
Apr 1, 2011
Messages
8
I have a command button on sheet 7 of a workbook. I need to attach a code to this command button that will open up the open file dialog box and allow the user to select one of a number of previously saved files. Then automatically copy range A2:D41 from sheet 3 of this loaded workbook to sheet 7 of the initial workbook. I have no idea how to do this and any help will be greatly appreciated.

James
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
James try this out

Sub openCopy()
Application.Dialogs(xlDialogOpen).Show
Sheets("Sheet3").Select
Range("A2:D41").Copy
ActiveWorkbook.Close
Sheets("sheet7").Select
Range("A2").PasteSpecial xlPasteAll
End Sub
 
Upvote 0
Nevermind already fixed that, the macros works however when it copies the data it is blank, I think this is because the workbook being copied from is closed before the data is copied over
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,334
Members
452,907
Latest member
Roland Deschain

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