Macro to copy data from one workbook to specific workbook selected in drop down

aburshd

New Member
Joined
Nov 8, 2013
Messages
9
Hello guys, I am a new to excel. Still learning. Please help me solve a problem. Thank you in advance.

COULD YOU PLEASE SOLVE:

CONSIDER 3 CELLS: A2,B2,C2 in a Workbook named, Data Entry.

A2
is where I write data in.
B2 is a drop down list of 3 different posting workbook's named: X, Y, Z.

I want a SAVE button.
When SAVE button is clicked, I want to copy cell A2 to the workbook chosen from the drop down lists in B2. If X is chosen, data will save in X workbook only.

I hope this makes sense. And expect to see wonderful solution from you guys.
Thanks once again :)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hello guys, I am a new to excel. Still learning. Please help me solve a problem. Thank you in advance.

COULD YOU PLEASE SOLVE:

CONSIDER 3 CELLS: A2,B2,C2 in a Workbook named, Data Entry.

A2
is where I write data in.
B2 is a drop down list of 3 different posting workbook's named: X, Y, Z.

I want a SAVE button.
When SAVE button is clicked, I want to copy cell A2 to the workbook chosen from the drop down lists in B2. If X is chosen, data will save in X workbook only.

I hope this makes sense. And expect to see wonderful solution from you guys.
Thanks once again :)

You can add the button manually and assign this macro to it. It is assumed that the names in the B2 dropdown include the file extension (e.g. .xlsx)
Code:
Sub saveA2()
Dim sh As Worksheet, wb As Workbook
Set sh = ThisWorkbook.Sheets(1) 'Edit sheet name
Set wb = Workbooks(sh.Range("B2").Value)
sh.Range("A2").Copy wb.Sheets(1).Cells(Rows.Count, 1).End(xlUp)(2)
wb.Save
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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