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 :)
 

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
11,290
Office Version
2013
Platform
Windows
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
 

aburshd

New Member
Joined
Nov 8, 2013
Messages
9
Not working. Bro could you attach file for me. I don't know if i sound wierd.
 

Forum statistics

Threads
1,082,250
Messages
5,364,022
Members
400,774
Latest member
Goldi paul

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top