Dynamic Dropdown in each cell

skittlz

New Member
Joined
Oct 26, 2012
Messages
35
Office Version
  1. 365
Platform
  1. Windows
Here's my code:

VBA Code:
Sub Macro1()

Asset = 15
'
    With Selection.Validation
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:=("Sequence(Asset)")
    End With
End Sub

Unfortunately, I cant get the sequence formula to work in the dropdown - unless I'm doing it wrong.

I'm trying to create dropdowns in a single cell, say B2, from SN001 through SN015 (with the Asset set at 15). In the next cell (B3), the Asset count might change - say 5, so I want the dropdowns to be SN001 through SN005.

I was thinking of using helper cells, but since Asset count will keep changing, it'll change the options in ALL the dropdown. Is there a simple macro way around this? I'm dealing with 35k lines of data, and growing, so Macro is the best way to do it.

How can I do this?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You can't use dynamic array formulas (such as SEQUENCE) in data validation lists. You can, however, refer to the output of a dynamic array (a spill formula) using the # referencing system.
So for example, you can put =SEQUENCE(15) in G3, and refer to that as the source for your data validation list as =$G$3#
So you can do something like this with helper cells, for example. The helpers can go on another sheet.

As an additional question, is the list the same in all instances but just of varying length?

1728708625522.png


Book1
ABCDEFGHIJ
1B2B3B4
2<= Dropdown in B2 refers to H3# as the source1556
3<= Dropdown in B3 refers to I3# as the source111
4<= Dropdown in B4 refers to J3# as the source222
5333
6444
7555
866
97
108
119
1210
1311
1412
1513
1614
1715
Sheet1
Cell Formulas
RangeFormula
H3:H17,J3:J8,I3:I7H3=SEQUENCE(H2)
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B2List=$H$3#
B3List=$I$3#
B4List=$J$3#
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,116
Members
453,021
Latest member
Justyna P

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