excel - Drop down wont select horizontal selection -


i have created dropdown in excel spreadsheet , selected values across horizontal axis. issue on drop down menu first value shows.

can round perhaps entering values macro when page loads?

below selections:

date incident problem end end outage service outage client service area business area fact cause action due date owner root cause code strategic client impact completed date pm owner region ifc # of strat clients impacted downtime minutes internal impact comments 

you need store values horizontal cells in string , use data validation.

assumption:

let's data looks shown below , want show list a1:m13 in cell d4

enter image description here

code:

sub sample()     dim ws worksheet     dim acell range, rng range     dim slist string      '~~> set relevant sheet     set ws = thisworkbook.sheets("sheet1")      ws         '~~> range has horz list         set rng = .range("a1:m1")          '~~> values of each cell , store in string         each acell in rng             slist = slist & "," & acell.value         next          slist = mid(slist, 2)          '~~> adding data validation cell d4         .range("d4").validation             .delete              .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:= _             xlbetween, formula1:=slist              .ignoreblank = true             .incelldropdown = true             .inputtitle = ""             .errortitle = ""             .inputmessage = ""             .errormessage = ""             .showinput = true             .showerror = true         end     end end sub 

output:

when run above code, see result

enter image description here


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -