VBA/Excel dynamic list control -


i want create pick list depend on provided on previous list there problem. using list validation, working until didn't close file. after reopen file, when list clear, gives me error , didn't want load data it.

so decided use control combo list, there problem creating array...

    sub rozwiƄ298_zmienianie(target)     dim integer     dim j integer     dim k integer     dim m integer     dim lista() variant     = 1     j = 1     m = 0      while sheets("dane").cells(i, 14) <> target.text         = + 1     loop     j =     while sheets("dane").cells(j, 14) = target.text         j = j + 1     loop     j = j - 1     k = j - + 1     redim lista(k)     m = 0 k         lista(m) = sheets("dane").cells(i, 15).text         = + 1     next m      sheets("formularz").shapes.range(array("drop down 298")).select     selection         .list = lista     end end sub 

now 2 questions... somehow it's working, give quite odd error after picking list( argument not optional) - i'm done wrong?

second: how set in worksheet_change(byval target range) condition picking list , use picked data create pick list?

try adding piece of code. tested it. work well.

dim validationrange range  sheets("formularz").cells(6, 2).select  set validationrange = sheets("dane").range("p" & & ":p" & j)  selection.validation     .delete     .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:=xlbetween, formula1:="='dane'!" & validationrange.address     .ignoreblank = true     .incelldropdown = true     .inputtitle = ""     .errortitle = ""     .inputmessage = ""     .errormessage = ""     .showinput = true     .showerror = true end 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -