我的工作表有各种验证列表,但是对于所有这些列表,我需要在单元格中选择用户自己的条目。
我知道您可以取消选中此框但是因为我的工作表定期重新生成,我需要以编程方式实现此目的。任何人都知道如何做到这一点?这是我创建下拉列表的代码:
TMyDBGrid = class(Vcl.DBGrids.TDBGrid)
答案 0 :(得分:1)
您在发布的代码中几乎得到了它,只需将.ShowError
更改为false,用户可以输入任何内容而不会被警告
For u = 1 To SpecDependencies.count
SpecDepList = SpecDepList & "," & SpecDependencies(u) & " - " & SpecDepDate(u)
Next
With CRC.Cells(ECURowInCRC, 8).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=SpecDepList
.IgnoreBlank = True
.InCellDropdown = True
.InputMessage = "View Spec Dependancies"
'.ErrorMessage = "No value selected"
.ShowInput = True
.ShowError = False
End With
End If
SpecDepList = ""
Set SpecDependencies = New Collection
Set SpecDepDate = New Collection