Copy worksheet from another closed workbook using VBA/userform

jd0219

New Member
Joined
Apr 23, 2019
Messages
1
Hi guys,

I recently started studying macro a week ago. Im trying to copy worksheet from a specific workbook to my main workbook. Currently i have 3 separate workbook where I copy the worksheet. Is there a way I can use a userform(a list box) to select a specific workbook?


Any help would be appreciated.
Thanks in advance
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I will need to ask several questions.
1. Do you know how to load your three workbook names into a Userform Listbox?
2. We would need to know all three workbook names
3. We need to know the name of the sheet to copy and where exactly to paste it.
like paste after sheet(3)
4. We would need to know the name of the UserForm Listbox
5. We need to know the Path to the 3 Workbooks. To Open them if their not already Opened.
6. And the Workbooks would have to be open or the script would have to Open the Workbook.
See we always need specific details
Your script would need to look something like this:

Code:
Private Sub CommandButton5_Click()
'Modified  4/24/2019  1:12:55 PM  EDT
Workbooks(ListBox1.Value).Sheets(1).Copy After:=Sheets(1)
ActiveSheet.Name = "My Copy"


Again this would depend on a lot of factors like I mentioned above.
 
Upvote 0

Forum statistics

Threads
1,223,743
Messages
6,174,244
Members
452,553
Latest member
red83

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