Excel VBA将validation列表读入variables
我试图find一个Excel VBA代码读取validation列表到一个variables。
我正在使用Excel 2010版本。
在下面的代码中,我使用variablesqNRdynamic设置值,并出现在下拉菜单中。 稍后我需要读取validation列表中的值,删除或更新某些值并设置新值。
我找不到任何将validation列表读入variables的示例代码。
With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=qNR .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With
谢谢!
假设它是一个列表types( validationtypes3 ),则Debug.Print Range(yourRange).Validation.Formula1
应打印出一个列表。 所以Object.Validation.Formula1
似乎为你工作。 在这里看到更多的信息。