Formula or VBA

bcs0262cop

New Member
Joined
May 22, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I have two worksheets in a workbook. In worksheet #1 I have a dropdown in cell C26, which contains 7 names. I would like a formula or VBA that when any name, selected from the dropdown, is selected the data in cell A26 is copied to the worksheet #2 in cell #D5. I have tried several formulas, they will work if only one criteria is entered from the dropdown. I am having issues
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
The dropdown contains names, i.e. John, Jim Charles, Mike, Sarah, Trace, Victor. If the name Charles, Mike, Sarah, or Trace is selected I want the value in cell A34 to be copied and pasted into Cell D24 in the second sheet. I can writ a formula that will copy if I just use one name, but not sure how to write it if any one of those names are selected
 
Upvote 0
What formula are you currently using?
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for the sheet containing the drop down in C26 and click 'View Code'. Paste the macro into the empty code window that opens up. Change the destination sheet name (in red) to suit your needs. Close the code window to return to your sheet. Make a selection in the drop down.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("C26")) Is Nothing Then Exit Sub
    Select Case Target.Value
        Case "Charles", "Mike", "Sarah", "Trace"
            Sheets("Sheet2").Range("D24") = Range("A34")
    End Select
End Sub
 
Upvote 0
Define:
I have a dropdown in cell C26, which contains 7 names.

What is a Dropdown?
Do you mean a Data Validation list?
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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