vba - Length of a string for a data validation list -
i having trouble data validation list. i'm using vba generate list database(another page of workbook).
the string, contains list, can greater 255 char.
when string greater 255 char, close file, try reopen file, says , suppresses data validation lists in workbook.
is there way work around error?
here code using:
for iter4 = 2 nbwsheet if wsheet.cells(iter4, 2) = cat , wsheet.cells(iter4, colmod) = "x" , wsheet.cells(iter4, colstd) = "oui" tablevalue = wsheet.cells(iter4, 4).value & " - " & wsheet.cells(iter4, 7).value tablevalue = replace(tablevalue, ",", chr(130)) 'remplace la virgule par le symbole alt0130 table = table & "," & tablevalue 'création de la liste end if next iter4 'ajout de la list cells(iglob, 5).validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:= _ xlbetween, formula1:=table .ignoreblank = true .incelldropdown = true .inputtitle = "" .errortitle = "" .inputmessage = "" .errormessage = "" .showinput = "" .showerror = "" end
any appreciated.
note : code generates many data validation lists
i found solution problem.
to make work, generated list in hidden sheet. of lists in column a. know witch list goes where, made iteration calculation each list. when list generated know start , end in column a
here code use
iter4 = 2 nbwsheet if wsheet.cells(iter4, 2) = cat , wsheet.cells(iter4, colmod) = "x" , wsheet.cells(iter4, colstd) = "oui" tablevalue = wsheet.cells(iter4, 4).value & " - " & wsheet.cells(iter4, 7).value tablevalue = replace(tablevalue, ",", chr(130)) 'remplace la virgule par le symbole alt0130 sheets("hidden").cells(iterrow, 1).value = tablevalue iterrow = iterrow + 1 rowcat = rowcat + 1 end if next iter4 'calcul du nombre de ligne dans la feuille hidden pour avoir la bonne information dans chaque liste rowcount = worksheetfunction.counta(sheets("hidden").columns(1)) rowdebut = rowcount - rowcat + 1 'ajout de la liste cells(iglob, 5).validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:= _ xlbetween, formula1:="=hidden!a" & rowdebut & ":a" & rowcount .ignoreblank = true .incelldropdown = true '.inputtitle = "" '.errortitle = "" '.inputmessage = "" '.errormessage = "" '.showinput = "" '.showerror = "" end iglob = iglob + 1 rowcat = 0 end if
Comments
Post a Comment