Copying text from 1 workbook to another based choosing an option in drop down list

Messier1983

New Member
Joined
Dec 31, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
i have 2 workbooks - Excel bookings and PHE

In the excel bookings workbook there is a drop down list at J6 when i select "Send" id like excel to copy the text in rows B6:I6 to the second workbook called PHE and the information sit in rows B6:I6

How can this be done
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Welcome to the Board!

Are both workbooks already open in Excel when you are doing this?
Are there multiple sheets in each workbook (if so, provide the sheet names of the sheets that you want to apply this to)?
 
Upvote 0
Make sure that both workbooks are open. Copy and paste this macro into the worksheet code module. Do the following: in the excel bookings workbook, right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Select "Send" in cell J6.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("J6")) Is Nothing Then Exit Sub
    If Target = "Send" Then
        Range("B6:I6").Copy Workbooks("PHE.xlsx").Sheets("Sheet1").Range("B6")
    End If
End Sub
Change the file extension (in red) and the destination sheet name (in blue) to suit your needs.
 
Upvote 0
Using the full names for each workbook i click send and nothing happens

1640966002259.png


1640965966612.png
 
Upvote 0
In your original post you said that the dropdown list was in J6. Based on the data you posted, it looks like the drop down list is in column K not column J. If this is true, change J6 to K6 in the code. If you want the code to apply to any row in column K, then change J6 to "K:K" in the code. Also, the column headers in the 2 workbooks don't match.
 
Upvote 0
Make sure that both workbooks are open. Copy and paste this macro into the worksheet code module. Do the following: in the excel bookings workbook, right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Select "Send" in cell J6.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("J6")) Is Nothing Then Exit Sub
    If Target = "Send" Then
        Range("B6:I6").Copy Workbooks("PHE.xlsx").Sheets("Sheet1").Range("B6")
    End If
End Sub
Change the file extension (in red) and the destination sheet name (in blue) to suit your needs.

Not sure what ive done wrong
1640966575915.png
 
Upvote 0
You can have only one Worksheet_Change event in any sheet. The two macros would have to be combined into one. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

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