VBA BUTTON to copy from one workbook to another

2.3k views Asked by At

and need help to accomplish a specific copy and paste. I have an active customer list That is always updating. And when the work is complete I have to prepare an invoice. I am trying with no success to create a button on my active costumer workbook that will copy the customer name that I select maybe by highlighting the cell which Is in column c, then transfer that name to a template named invoice in cell B3. The template already set up with Vlookup and if function to populate all information based on the customer name. I want the button to copy the cell that I select not a whole column or row. Is this code possible?

1

There are 1 answers

7
Mike Powell On

Both these suggestions assume that you are in the Customer workbook/sheet with the cell selected ... button code could look like this:

Sub Copy_Cust()
    Workbooks("Invoice").Sheets("Sheet1").Range("B1") = ActiveCell
End Sub

or

Sub Copy_Cust2()
    Selection.Copy
    Workbooks("Invoice").Sheets("Sheet1").Range("B1").PasteSpecial
    Application.CutCopyMode = False
End Sub