user4251973
user4251973

Reputation: 19

VBA BUTTON to copy from one workbook to another

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?

Upvotes: 1

Views: 2414

Answers (1)

Mike Powell
Mike Powell

Reputation: 260

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

Upvotes: 1

Related Questions