Define Name over several cells

Davidwazza

New Member
Joined
Sep 10, 2007
Messages
36
Hi all,

I seem to have this problem, hopefully it is easy to solve.

I want to define a list that I want to use as a dropdown list in another sheet, so need to define a name over two entries in cell E10 and E18. I select both those cells, and Define -> Name, but it doesn't seem to work:
='Sheet 1'!$E$10, 'Sheet 1'!$E$18

I have tried to redefine as an array, e.g.
={'Sheet 1'!$E$10, 'Sheet 1'!$E$18}
but this doesn't seem to work.

Anyone have any ideas?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,

I hope the validation list will work only for continuous named ranges. But I hope the below code might help. Alter the code as required.

Code:
Sub test()
    Sheets(2).Range("B5").Validation.Add Type:=xlValidateList, Formula1:=Sheets(1).Range("E10").Value & ", " & Sheets(1).Range("E18").Value
End Sub
 
Upvote 0
Ok interesting, thanks dine.

Obviously this will only update if I run that function, so what would I need to add to update it, e.g. I guess if E10/E18 gets updated, it will automatically update that data validation function? Possibly run test() during startup of the excel sheet too?
 
Upvote 0
Post the below code in ThisWorkbook in VBA.
Now the code will execute once you open the workbook.

Code:
Private Sub Workbook_Open()
    Sheets(2).Range("B5").Validation.Add Type:=xlValidateList, Formula1:=Sheets(1).Range("E10").Value & ", " & Sheets(1).Range("E18").Value
End Sub

Hope this helps!!

Thanks,
Dine
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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